Click here to Skip to main content
15,564,017 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
May I know how to get the list of regions using System.globalization namespace.
Updated 11-Jul-18 18:49pm
Farhan Ghumra 20-Jun-12 2:56am    
Do you want region or country ?
Sandeep Mewara 20-Jun-12 8:34am    
Not clear.

public class Country
        public string countryCode { get; set; }
        public string countryName { get; set; }

public List<Country> GetCountries()
            //create a new Generic list to hold the country names returned
            List<Country> countryList = new List<Country>();

            CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.SpecificCultures);

            var v = cultures.Where(C => C.LCID != 127 & !C.IsNeutralCulture).Select(C => new { new RegionInfo(C.LCID).EnglishName, new RegionInfo(C.LCID).Name }).ToList();

            countryList = v.GroupBy(C => new { C.EnglishName, C.Name }).Select(C => new Country() { countryCode = C.Key.Name, countryName = C.Key.EnglishName }).OrderBy(C => C.countryName).ToList();

            return countryList;
Share this answer
Afzaal Ahmad Zeeshan 12-Jul-18 9:01am    
How does this solution improve on top of the one that is already provided?
Member 11585739 18-Jul-18 22:49pm    
it is the same solution , but just i did it using linq query(if any one want it) with extra column county code .
//Code snippet
/// <summary>
/// method for generating a country list, say for populating
/// a ComboBox, with country options. We return the
/// values in a Generic List<t>
/// </t></summary>
/// <returns></returns>
public static List<string> GetCountryList()
    //create a new Generic list to hold the country names returned
    List<string> cultureList = new List<string>();

    //create an array of CultureInfo to hold all the cultures found, these include the users local cluture, and all the
    //cultures installed with the .Net Framework
    CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);

    //loop through all the cultures found
    foreach (CultureInfo culture in cultures)
        //pass the current culture's Locale ID (
        //to the RegionInfo contructor to gain access to the information for that culture
        RegionInfo region = new RegionInfo(culture.LCID);

        //make sure out generic list doesnt already
        //contain this country
        if (!(cultureList.Contains(region.EnglishName)))
            //not there so add the EnglishName (
            //value to our generic list
    return cultureList;

//Example usage
foreach(string country in GetCountryList())
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900