Does custom English characters use bad names in C # names?

English is not my native language. I would like to use non-English characters in my code, for example: "รง, รฃ, รฉ ..."

Is it wrong to use these characters for classes, variable declarations, or methods?

I am not asking which characters are technically available in C #. My question is whether this is good or not.

+7
c #
source share
3 answers

No technical issues using non-English characters. C # allows a lot of Unicode characters in variable names. The real question is whether this is good or not.

To answer this, you really need to ask yourself the question: "Who is my audience?" If your code will only display French speakers by typing a French layout on your keyboard, รง is probably a very valid character. However, if you intend to change your code to others whose keyboard layout is not French, you may find it very difficult to type for this character. This will mean that if they want to use your variable name, they will have to cut / paste it into place, because they cannot enter it directly. This would be a death sentence for any development.

So, find out who your audience is and limit yourself to the keyboard layout.

+8
source share

It is supported. See here: http://rosettacode.org/wiki/Unicode_variable_names#C.23

Whether this is bad practice or not is hard to say. If it works, it works. Personally, I would choose a language that all possible participants understand.

+5
source share

I just tried the 3 characters you specified there, and compiled when I used them as variable names, so I assume that they will not cause problems in your code.

+1
source share

All Articles