The CultureInfo class will provide us all Culture information available in .Net Framework. You can use CultureInfo.GetCultures static method for getting all the culture information. To get associated specific culture, please use static method CultureInfo.CreateSpecificCulture.
The following example will show you how to get all culture information.
static void Main(string[] args) { // Get culture names List<string> list = new List<string>(); foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures)) { catch(Exception) { }string specName = "(none)"; try { specName = CultureInfo.CreateSpecificCulture(ci.Name).Name;} list.Add(string.Format("{0,-12}{1,-12}{2}", ci.Name, specName, ci.EnglishName)); } list.Sort(); Console.WriteLine("CULTURE SPEC.CULTURE ENGLISH NAME"); Console.WriteLine("----------------------------------------------------"); foreach (string str in list) Console.WriteLine(str); Console.ReadLine(); } |
No comments:
Post a Comment