If you need to show a list of languages, or more general CultureInfos, you might want to sort them by the name they show up in the GUI.
This can easily be done by using a custom comparer. This implements the generic IComparer<T> interface.
public class CultureInfoComparer : IComparer<CultureInfo> { public int Compare(CultureInfo x, CultureInfo y) { return (new CaseInsensitiveComparer().Compare(x.DisplayName, x.DisplayName)); } }
Usage:
var languages = new List<CultureInfo>(); // Add CultureInfos to the list languages.Sort(new CultureInfoComparer());