任何人都可以帮助填充国家名称列表,其各自的两个字母代码和三个字母代码。我尝试了下面的代码片段,但它给了我不完整的结果。
static void Main(string[] args)
{
List<string> list = new List<string>();
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures))
{
try
{
RegionInfo myRI1 = new RegionInfo(ci.LCID);
list.Add(String.Format("{0,-12}{1,-12}{2}", myRI1.TwoLetterISORegionName, myRI1.EnglishName, myRI1.ThreeLetterISORegionName));
}
catch { }
}
list.Sort(); // sort by name
// write to console
foreach (string str in list)
Console.WriteLine(str);
Console.WriteLine("Total Countries" + list.Count.ToString());
Console.ReadKey();
}
}