Export (0) Print
Expand All

Performing Culture-Insensitive String Operations in Arrays 

Overloads of the Array.Sort and Array.BinarySearch methods perform culture-sensitive sorts by default using the Thread.CurrentCulture property. Culture-sensitive results returned by these methods can vary by culture due to differences in sort orders. To eliminate culture-sensitive behavior, use one of the overloads of this method that accepts a comparer parameter. The comparer parameter specifies the IComparer implementation to use when comparing elements in the array. For the IComparer parameter, specify a custom invariant comparer class that uses CultureInfo.InvariantCulture. An example of a custom invariant comparer class is provided in the "Using the SortedList Class" subtopic of the Performing Culture-Insensitive String Operations in Collections topic.

See Also

Community Additions

ADD
Show:
© 2015 Microsoft