I want to retrieve all country codes (like +61 for Australia) by giving country name. Is there built in method for retrieving country code in c# like
int countryCode = CultureInfo.getCountryCode("CountryName");
I saw some methods on internet but non of them is simple. I want simple method for retrieving country code by giving country name. I saw Google libphonenumber but is there any simple solution because I am having trouble while including thi library because I am using visual studio 2015 but this library is build in visual studio 2017. If this library is only the solution then how can I include this library in my visual studio 2015 project?
This is the code for getting all countries
public static List<string> countryList()
{
List<string> cultureList = new List<string>();
CultureInfo[] info = getCultureInfo();
foreach (CultureInfo culture in info)
{
RegionInfo region = new RegionInfo(culture.LCID);
if (!(cultureList.Contains(region.EnglishName)))
{
cultureList.Add(region.EnglishName);
}
}
cultureList.Sort();
return cultureList;
}
Now, how can I get country codes all of theses?