internal object GetCounteryName() { List <string> cultureList = new List <string>(); CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures); cultureList.Add("--- Select One ---"); foreach (CultureInfo culture in cultures) { CultureTypes ct = culture.CultureTypes; String s = ct.ToString(); if (!s.Contains("NeutralCultures")) { // check if it's not a invariant culture if (culture.LCID != 127) { RegionInfo region = new RegionInfo(culture.LCID); // add countries that are not in the list if (!(cultureList.Contains(region.EnglishName))) { cultureList.Add(region.EnglishName); } } } } cultureList.Sort(); // sort alphabetically return(cultureList); }
public void SafeParseWhenValueIsDefinedReturnsCorrectLabel(CultureTypes value) { var actual = EnumExtensions.SafeParse <CultureTypes>(value.ToString()); Assert.Equal(actual, value); }