This code:
Console.WriteLine("~".CompareTo("a") > 0);
Console.WriteLine('~'.CompareTo('a') > 0);
Gives me:
False
True
WTF?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Another way to show this behaviour is:
The difference may be subtle, but it is documented. The comparison in
Char.CompareTo(Char)isAt the same time, the documentation for
String.CompareTo(String)I.e. the first one bases the comparison on order, the latter on the default rules in the current culture (the order you might see in a dictionary).