这怎么可能? (这取自VS2008中的即时窗口)
?string.Compare("-", "+")
-1
?string.Compare("-0", "+0")
1
最佳答案
来自 String.Compare 的评论(强调我的):
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.
关于.net - string.Compare 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1873701/