If you have configured the culture of the current stream to the language you want to sort, then this should work automatically (provided that you do not want a special individual sort order). Like this
List<string> mylist; .... Thread.CurrentThread.CurrentCulture = new CultureInfo("pl-PL"); mylist.Sort();
You will receive a list sorted according to the settings of the Polish culture.
Refresh . If the culture settings do not sort them the way you need, then another option is to implement your own string matching.
Update 2 : string comparison example:
public class DiacriticStringComparer : IComparer<string> { private static readonly HashSet<char> _Specials = new HashSet<char> { 'Γ©', 'Ε', 'Γ³', 'ΓΊ' }; public int Compare(string x, string y) {
Disclaimer: I have not tested it, but it should give you a general idea. Also char.CompareTo() does not compare lexicographically, but, according to one source, I found <and> does - cannot guarantee it. In the worst case, you need to convert cx and cy to strings, and then use the default string comparison.
source share