Get All Cultures in .Net
2010-03-25 12:47 敏捷的水 阅读(552) 评论(0) 编辑 收藏 举报This example shows how to get all culture names in the .NET Framework. Use static method CultureInfo.Get Cultures. To get associated specific culture use static method CultureInfo.CreateSpecificCul ture.
Following code is modified MSDN example (it's just sorted by culture name).
// get culture names List<string> list = new List<string>(); foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures)) { string specName = "(none)"; try { specName = CultureInfo.CreateSpecificCulture(ci.Name).Name; } catch { } list.Add(String.Format("{0,-12}{1,-12}{2}", ci.Name, specName, 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);
扫码关注公众号,了解更多管理,见识,育儿等内容
作者: 王德水
出处:http://www.cnblogs.com/cnblogsfans
版权:本文版权归作者所有,转载需经作者同意。
出处:http://www.cnblogs.com/cnblogsfans
版权:本文版权归作者所有,转载需经作者同意。