Reputation: 3092
Considering that the C# compiler should be able to handle Unicode characters, I'm curious to know why the subscript character doesn't seem to work? It'd be nice to use it in conjunction with Linq, I think (pseudo-code):
collection.Sort((x₀, x₁) => x₁.CompareTo(x₀));
Upvotes: 1
Views: 401
Reputation: 151674
Because subscript characters aren't in the allowed character classes, basically.
See C# language specification, 2.4.2 Identifiers for the rules. Digits in an identifier must be of the Unicode class "Nd", or "Number, decimal digit".
See Unicode Character 'SUBSCRIPT ONE' (U+2081) for the information on this particular character:
Category Number, Other [No]
Character.isDigit() No
Character.isLetter() No
Character.isLetterOrDigit() No
This also means that however you compare it, a subscript 1 != the digit 1.
Upvotes: 6