i need to sort an string Array and it MUST be sorted by ascii.
if using Array.Sort(myArray), it won't work.
for example:
myArray is ("aAzxxxx","aabxxxx")
if using Array.Sort(myArray)
the result will be
aabxxxx
aAzxxxx
but if ascii sort, because A < a, (capital A is 65, a is 97, so A < a)
the result will be
aAzxxxx
aabxxxx
this is the result i need. any ideas about how to ASCII sort an string Array?
thx
解决方案
If I have understood you correctly, you want to perform an Ordinal comparison.
Array.Sort(myArray, StringComparer.Ordinal);