The RegionInfo class in System.Globilization provides useful details about a region (country) such as the name, currency and ISO identifying codes. If you want to get a RegionInfo for every available country then you can use the following code which came from this post.

public static List<RegionInfo> GetCountries()
{
	List<RegionInfo> countries = new List<RegionInfo>();
	foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
	{
		RegionInfo country = new RegionInfo(culture.LCID);
		if (countries.Where(p => p.Name == country.Name).Count() == 0)
			countries.Add(country);
	}
	return countries.OrderBy(p => p.EnglishName).ToList();
}

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *