Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Sandbox
- {
- public class Country
- {
- public string Name { get; set; }
- public string ThreeLetterAbbr { get; set; }
- public string TwoLetterAbbr { get; set; }
- }
- class Program
- {
- static void Main(string[] args)
- {
- var countryList = GetAllCountries();
- }
- public static IEnumerable<Country> GetAllCountries()
- {
- var countries = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
- .Select(ci => new RegionInfo(ci.LCID))
- .Select(ri => new Country
- {
- Name = ri.EnglishName,
- ThreeLetterAbbr = ri.TwoLetterISORegionName,
- TwoLetterAbbr = ri.ThreeLetterISORegionName
- }).ToList();
- return countries;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement