LINQ

Sorting a list based on another culture, than the current:
Today I had to sort a list of texts written in Danish on a MOSS site where the culture was English. In this case, Danish characters Æ, Å and Ø was sorted incorrect.

List<string> links = new List<string>();
... // fill list with strings
CultureInfo danishCultureInfo = new CultureInfo("da-DK");
links.Sort((x, y) => string.Compare(x,y,true,danishCultureInfo));


Sidst opdateret: 21. jan.  2011