I have tried to enter non ASCII characters in C# identifiers, and the program compiles and runs just fine (at least at first glance). To be more precise, I use Croatian diacritical characters (čćđšž) in enums. I really need to use these special characters because I map string enums as value objects in NHibernate. It would be really ugly to have to avoid these standard characters when showing them as lookups to the user. Before I start using enums this way on a big scale, I really need to know if there are any implications (hidden pitfalls) to such a programming technique (especially in regard to NHibernate)? Or, if you have a better way handling this, please let me know.
Also, are there any problems with tools used for refactoring, SVN etc.
The C# language uses unicode encoding, which means your special character will not be a problem. However, I like to keep my code in english without special characters. I am yet to find a problem which justifies using culture specific naming.
From the C# language specification:
A C# program consists of one or more source files, known formally as compilation units (§9.1). A source file is an ordered sequence of Unicode characters. Source files typically have a one-to-one correspondence with files in a file system, but this correspondence is not required. For maximal portability, it is recommended that files in a file system be encoded with the UTF-8 encoding.
Section 2.1 (Microsoft C# Language Specification)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With