答案 0 :(得分:10)
var names = CultureInfo.GetCultures(CultureTypes.AllCultures).ToLookup(x => x.EnglishName);
names["English"].FirstOrDefault();
答案 1 :(得分:8)
var EnglishCulture = CultureInfo.GetCultures(CultureTypes.AllCultures)
.Where(r => r.EnglishName == "English");
或者如果您需要FirstOrDefault
var EnglishCulture = CultureInfo.GetCultures(CultureTypes.AllCultures)
.FirstOrDefault(r=> r.EnglishName == "English");
答案 2 :(得分:3)
没有内置方法可以通过它的英文名称来获取文化,所以你可以写一个:
public static CultureInfo getCultureByEnglishName(String englishName)
{
// create an array of CultureInfo to hold all the cultures found,
// these include the users local culture, and all the
// cultures installed with the .Net Framework
CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
// get culture by it's english name
var culture = cultures.FirstOrDefault(c =>
c.EnglishName.Equals(englishName, StringComparison.InvariantCultureIgnoreCase));
return culture;
}
以下是演示:http://ideone.com/KX4U8l