Consider this code
var strings2 = new List<string>
{
"0", // Ascii code 48 (decimal)
"|" // Ascii code 125 (decimal)
};
var sorted = strings2.OrderBy(x => x).ToArray();
Sorted contains "|", "0"
. Now consider this code (all I did was change "|"
to "."
)
var strings2 = new List<string>
{
"0", // Ascii code 48 (decimal)
"." // Ascii code 46 (decimal)
};
var sorted = strings2.OrderBy(x => x).ToArray();
Now sorted contains ".", "0"
In both cases the "0"
comes at the end even though 125 > 48, what is going on here?
"
) not chars (delimited by single quotes'
). As @Sam mentions, it's probably got something to do with it.