c# - Any reference that confirms that Array.Sort(charArray, StringComparer.Ordinal) works? -
i sort array of chars according ordinal positions (code points) in unicode table.
i see following code works:
char[] chararray = new[] { 'h', 'e', 'l', 'l', 'o' }; array.sort(chararray, stringcomparer.ordinal);
but looks bit weird. first because both of these parameters non-generic, , secondly, here using stringcomparer compare chars.
is guaranteed work? reference?
orderby(chr => chr)
trick. char
icomparable
, comparable definition compares integer/"ordinal" value of chars.
Comments
Post a Comment