How this can be ? (This is taken from the immediate window in VS2008)
?string.Compare("-", "+")
-1
?string.Compare("-0", "+0")
1
How this can be ? (This is taken from the immediate window in VS2008)
?string.Compare("-", "+")
-1
?string.Compare("-0", "+0")
1
From the remarks on String.Compare (emphasis mine):
The comparison uses the current culture to obtain culture-specific information such as casing rules and the alphabetic order of individual characters. For example, a culture could specify that certain combinations of characters be treated as a single character, or uppercase and lowercase characters be compared in a particular way, or that the sorting order of a character depends on the characters that precede or follow it.
The C# manual writes:
The comparison uses the current culture to obtain culture-specific information such as casing rules and the alphabetic order of individual characters. For example, a culture could specify that certain combinations of characters be treated as a single character, or uppercase and lowercase characters be compared in a particular way, or that the sorting order of a character depends on the characters that precede or follow it.
The comparison is performed using word sort rules. For more information about word, string, and ordinal sorts, see System.Globalization.CompareOptions.