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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -