How to get all culture names in the .NET?
Following example shows how to get all culture names in the .NET Framework. Use
static method CultureInfo.GetCultures.
To get associated specific culture use static method CultureInfo.CreateSpecificCulture.
Following code is modified MSDN example.
Code:
Following code is modified MSDN example.
Code:
// get all culture names Listlist = new List (); foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures)) { string cultureName = "(none)"; try { cultureName = CultureInfo.CreateSpecificCulture(ci.Name).Name; } catch { } list.Add(String.Format("{0,-10}{1,-10}{2}", ci.Name, cultureName, ci.EnglishName)); } list.Sort(); // sort by name // write to console Console.WriteLine("CULTURE SPEC.CULTURE ENGLISH NAME"); Console.WriteLine("--------------------------------------------------------------"); foreach (string str in list) Console.WriteLine(str);
Execute the aboe code and get all culture names.
If you feel this is helpful or you like it, Please share this using share buttons available on page.
Comments
Post a Comment