I consider .NET class SortKey as one ugliest kludges of the entire .NET framework, especially if you compare it with the Java CollationKey class. Why?
First, there is the static Compare method, but the SortKey does not implement IComparable, nor IComparer. This makes it pretty hard to store them in sortable collections as the ArrayList.
Second, the Equals and GetHashCode of SortKey operate on both the byte array and the original string. Imagine a scenario where you have a set of localized strings, and you want to check whether the set contains a certain word in various spellings. So the list might contain the German “weiß”, which means it also contains “weiss”.
One would think that the fastest ways to implement this using .NET is to create a Hashtable with SortKeys as keys, and to check whether the table contains a certain key. However, since the Equals and GetHashCode also operate on the original string, it will not work. The byte arrays might be equal for weiß and weiss, but the original strings are not.
Both of these issues can be resolved (the first by writing a IComparer adapter which uses SortKey.Compare; the second by a custom IHashCodeProvider which only relies on the byte array), but kludges they remain.