What characters are allowed in C# class name?

The spec details are here. Essentially, any unicode character (including unicode escapes) in the character classes Lu, Ll, Lt, Lm, Lo, Nl, Mn, Mc, Nd, Pc, and Cf. The first character is an exception and it must be a letter (classes Lu, Ll, Lt, Lm, or Lo) or an underscore. Also, if the identifier is a keyword, you must stick an @ in front of it. The @ is optional otherwise.


Valid identifiers in C# are defined in the C# Language Specification, item 9.4.2. The rules are very simple:

  • An identifier must start with a letter or an underscore
  • After the first character, it may contain numbers, letters, connectors, etc
  • If the identifier is a keyword, it must be prepended with “@”

source


The Unicode categories can be found here: http://www.dpawson.co.uk/xsl/rev2/UnicodeCategories.html

From there, you can pick most things from within the groups (from the specs, that others have correctly pointed to too):

Lu, Ll, Lt, Lm, Lo, Nl, Mn, Mc, Nd, Pc, Cf

Be aware though, that Visual Studio (or is it ReSharper) won't necessarily be fond of them all, but most of them do compile. Take, for example, the character 30FB KATAKANA MIDDLE DOT. It compiles fine, but it doesn't play nice with the IDE. But this strange thingy FE34 PRESENTATION FORM FOR VERTICAL WAVY LOW LINE works just fine.

Here's a seperator that works fine:

class Person〱WorkOffice〱Helper〱Class
{

}

I'm not saying I recommend using strange characters though. But for special occasions as this seems to be :)

Take note that the specification says that it allows characters from Unicode 3.0. I overlooked that and wondered why a lot of characters wouldn't work, though they were from the right groups. Check this question for details.