且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在数据表中创建组合框列

更新时间:2023-10-19 20:54:34

这只是我的建议,.NET Framework 已经有一个国家/地区列表.所以你可以使用这个类.我忘了是谁创建了这个代码 :)

this is just my suggestion, the .NET Framework had a already list of countries. so you can use this class. i forgot who created this code :)

public static class CountryEntries
    {
        public static IEnumerable<Country> GetCountries()
        {
            return from ri in
                       from ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures)
                       select new RegionInfo(ci.LCID)
                       orderby ri.DisplayName
                   group ri by ri.TwoLetterISORegionName into g                       
                   select new Country
                   {
                       CountryId = g.Key,
                       Title = g.First().DisplayName
                   };
        }
        public class Country
        {
            public string CountryId { get; set; }
            public string Title { get; set; }
        }
    }