using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Infrastructure { public class CountryPhoneCode { public CountryPhoneCode(string name, string alpha2, string alpha3, int numericCode, string[] dialCodes = null) { Name = name; Alpha2 = alpha2; Alpha3 = alpha3; NumericCode = numericCode; DialCodes = dialCodes; } public string Name { get; private set; } public string Alpha2 { get; private set; } public string Alpha3 { get; private set; } public int NumericCode { get; private set; } public string[] DialCodes { get; private set; } public override string ToString() { return DialCodes!=null && DialCodes.Any() ? $"{Name} {DialCodes[0]}":""; } public static IEnumerable GetCollection() { // This collection built from Wikipedia entry on ISO3166-1 on 9th Feb 2016 return new[] { new CountryPhoneCode("Afghanistan", "AF", "AFG", 4, new[] { "93" }), new CountryPhoneCode("Åland Islands", "AX", "ALA", 248, new[] { "358" }), new CountryPhoneCode("Albania", "AL", "ALB", 8, new[] { "355" }), new CountryPhoneCode("Algeria", "DZ", "DZA", 12, new[] { "213" }), new CountryPhoneCode("American Samoa", "AS", "ASM", 16, new[] { "1 684" }), new CountryPhoneCode("Andorra", "AD", "AND", 20, new[] { "376" }), new CountryPhoneCode("Angola", "AO", "AGO", 24, new[] { "244" }), new CountryPhoneCode("Anguilla", "AI", "AIA", 660, new[] { "1 264" }), new CountryPhoneCode("Antarctica", "AQ", "ATA", 10, new[] { "672" }), new CountryPhoneCode("Antigua and Barbuda", "AG", "ATG", 28, new[] { "1 268" }), new CountryPhoneCode("Argentina", "AR", "ARG", 32, new[] { "54" }), new CountryPhoneCode("Armenia", "AM", "ARM", 51, new[] { "374" }), new CountryPhoneCode("Aruba", "AW", "ABW", 533, new[] { "297" }), new CountryPhoneCode("Australia", "AU", "AUS", 36, new[] { "61" }), new CountryPhoneCode("Austria", "AT", "AUT", 40, new[] { "43" }), new CountryPhoneCode("Azerbaijan", "AZ", "AZE", 31, new[] { "994" }), new CountryPhoneCode("Bahamas", "BS", "BHS", 44, new[] { "1 242" }), new CountryPhoneCode("Bahrain", "BH", "BHR", 48, new[] { "973" }), new CountryPhoneCode("Bangladesh", "BD", "BGD", 50, new[] { "880" }), new CountryPhoneCode("Barbados", "BB", "BRB", 52, new[] { "1 246" }), new CountryPhoneCode("Belarus", "BY", "BLR", 112, new[] { "375" }), new CountryPhoneCode("Belgium", "BE", "BEL", 56, new[] { "32" }), new CountryPhoneCode("Belize", "BZ", "BLZ", 84, new[] { "501" }), new CountryPhoneCode("Benin", "BJ", "BEN", 204, new[] { "229" }), new CountryPhoneCode("Bermuda", "BM", "BMU", 60, new[] { "1 441" }), new CountryPhoneCode("Bhutan", "BT", "BTN", 64, new[] { "975" }), new CountryPhoneCode("Bolivia (Plurinational State of)", "BO", "BOL", 68, new[] { "591" }), new CountryPhoneCode("Bonaire, Sint Eustatius and Saba", "BQ", "BES", 535, new[] { "599" }), new CountryPhoneCode("Bosnia and Herzegovina", "BA", "BIH", 70, new[] { "387" }), new CountryPhoneCode("Botswana", "BW", "BWA", 72, new[] { "267" }), new CountryPhoneCode("Bouvet Island", "BV", "BVT", 74), new CountryPhoneCode("Brazil", "BR", "BRA", 76, new[] { "55" }), new CountryPhoneCode("British Indian Ocean Territory", "IO", "IOT", 86, new[] { "246" }), new CountryPhoneCode("Brunei Darussalam", "BN", "BRN", 96, new[] { "673" }), new CountryPhoneCode("Bulgaria", "BG", "BGR", 100, new[] { "359" }), new CountryPhoneCode("Burkina Faso", "BF", "BFA", 854, new[] { "226" }), new CountryPhoneCode("Burundi", "BI", "BDI", 108, new[] { "257" }), new CountryPhoneCode("Cabo Verde", "CV", "CPV", 132, new[] { "238" }), new CountryPhoneCode("Cambodia", "KH", "KHM", 116, new[] { "855" }), new CountryPhoneCode("Cameroon", "CM", "CMR", 120, new[] { "237" }), new CountryPhoneCode("Canada", "CA", "CAN", 124, new[] { "1" }), new CountryPhoneCode("Cayman Islands", "KY", "CYM", 136, new[] { "1 345" }), new CountryPhoneCode("Central African Republic", "CF", "CAF", 140, new[] { "236" }), new CountryPhoneCode("Chad", "TD", "TCD", 148, new[] { "235" }), new CountryPhoneCode("Chile", "CL", "CHL", 152, new[] { "56" }), new CountryPhoneCode("China", "CN", "CHN", 156, new[] { "86" }), new CountryPhoneCode("Christmas Island", "CX", "CXR", 162, new[] { "61" }), new CountryPhoneCode("Cocos (Keeling) Islands", "CC", "CCK", 166, new[] { "61" }), new CountryPhoneCode("Colombia", "CO", "COL", 170, new[] { "57" }), new CountryPhoneCode("Comoros", "KM", "COM", 174, new[] { "269" }), new CountryPhoneCode("Congo", "CG", "COG", 178, new[] { "242" }), new CountryPhoneCode("Congo (Democratic Republic of the)", "CD", "COD", 180, new[] { "243" }), new CountryPhoneCode("Cook Islands", "CK", "COK", 184, new[] { "682" }), new CountryPhoneCode("Costa Rica", "CR", "CRI", 188, new[] { "506" }), new CountryPhoneCode("Côte d'Ivoire", "CI", "CIV", 384, new[] { "225" }), new CountryPhoneCode("Croatia", "HR", "HRV", 191, new[] { "385" }), new CountryPhoneCode("Cuba", "CU", "CUB", 192, new[] { "53" }), new CountryPhoneCode("Curaçao", "CW", "CUW", 531, new[] { "599" }), new CountryPhoneCode("Cyprus", "CY", "CYP", 196, new[] { "357" }), new CountryPhoneCode("Czech Republic", "CZ", "CZE", 203, new[] { "420" }), new CountryPhoneCode("Denmark", "DK", "DNK", 208, new[] { "45" }), new CountryPhoneCode("Djibouti", "DJ", "DJI", 262, new[] { "253" }), new CountryPhoneCode("Dominica", "DM", "DMA", 212, new[] { "1 767" }), new CountryPhoneCode("Dominican Republic", "DO", "DOM", 214, new[] { "1 809", "1 829", "1 849" }), new CountryPhoneCode("Ecuador", "EC", "ECU", 218, new[] { "593" }), new CountryPhoneCode("Egypt", "EG", "EGY", 818, new[] { "20" }), new CountryPhoneCode("El Salvador", "SV", "SLV", 222, new[] { "503" }), new CountryPhoneCode("Equatorial Guinea", "GQ", "GNQ", 226, new[] { "240" }), new CountryPhoneCode("Eritrea", "ER", "ERI", 232, new[] { "291" }), new CountryPhoneCode("Estonia", "EE", "EST", 233, new[] { "372" }), new CountryPhoneCode("Ethiopia", "ET", "ETH", 231, new[] { "251" }), new CountryPhoneCode("Falkland Islands (Malvinas)", "FK", "FLK", 238, new[] { "500" }), new CountryPhoneCode("Faroe Islands", "FO", "FRO", 234, new[] { "298" }), new CountryPhoneCode("Fiji", "FJ", "FJI", 242, new[] { "679" }), new CountryPhoneCode("Finland", "FI", "FIN", 246, new[] { "358" }), new CountryPhoneCode("France", "FR", "FRA", 250, new[] { "33" }), new CountryPhoneCode("French Guiana", "GF", "GUF", 254, new[] { "594" }), new CountryPhoneCode("French Polynesia", "PF", "PYF", 258, new[] { "689" }), new CountryPhoneCode("French Southern Territories", "TF", "ATF", 260, new[] { "262" }), new CountryPhoneCode("Gabon", "GA", "GAB", 266, new[] { "241" }), new CountryPhoneCode("Gambia", "GM", "GMB", 270, new[] { "220" }), new CountryPhoneCode("Georgia", "GE", "GEO", 268, new[] { "995" }), new CountryPhoneCode("Germany", "DE", "DEU", 276, new[] { "49" }), new CountryPhoneCode("Ghana", "GH", "GHA", 288, new[] { "233" }), new CountryPhoneCode("Gibraltar", "GI", "GIB", 292, new[] { "350" }), new CountryPhoneCode("Greece", "GR", "GRC", 300, new[] { "30" }), new CountryPhoneCode("Greenland", "GL", "GRL", 304, new[] { "299" }), new CountryPhoneCode("Grenada", "GD", "GRD", 308, new[] { "1 473" }), new CountryPhoneCode("Guadeloupe", "GP", "GLP", 312, new[] { "590" }), new CountryPhoneCode("Guam", "GU", "GUM", 316, new[] { "1 671" }), new CountryPhoneCode("Guatemala", "GT", "GTM", 320, new[] { "502" }), new CountryPhoneCode("Guernsey", "GG", "GGY", 831, new[] { "44 1481" }), new CountryPhoneCode("Guinea", "GN", "GIN", 324, new[] { "224" }), new CountryPhoneCode("Guinea-Bissau", "GW", "GNB", 624, new[] { "245" }), new CountryPhoneCode("Guyana", "GY", "GUY", 328, new[] { "592" }), new CountryPhoneCode("Haiti", "HT", "HTI", 332, new[] { "509" }), new CountryPhoneCode("Heard Island and McDonald Islands", "HM", "HMD", 334), new CountryPhoneCode("Holy See", "VA", "VAT", 336, new[] { "379" }), new CountryPhoneCode("Honduras", "HN", "HND", 340, new[] { "504" }), new CountryPhoneCode("Hong Kong", "HK", "HKG", 344, new[] { "852" }), new CountryPhoneCode("Hungary", "HU", "HUN", 348, new[] { "36" }), new CountryPhoneCode("Iceland", "IS", "ISL", 352, new[] { "354" }), new CountryPhoneCode("India", "IN", "IND", 356, new[] { "91" }), new CountryPhoneCode("Indonesia", "ID", "IDN", 360, new[] { "62" }), new CountryPhoneCode("Iran", "IR", "IRN", 364, new[] { "98" }), new CountryPhoneCode("Iraq", "IQ", "IRQ", 368, new[] { "964" }), new CountryPhoneCode("Ireland", "IE", "IRL", 372, new[] { "353" }), new CountryPhoneCode("Isle of Man", "IM", "IMN", 833, new[] { "44 1624" }), new CountryPhoneCode("Israel", "IL", "ISR", 376, new[] { "972" }), new CountryPhoneCode("Italy", "IT", "ITA", 380, new[] { "39" }), new CountryPhoneCode("Jamaica", "JM", "JAM", 388, new[] { "1 876" }), new CountryPhoneCode("Japan", "JP", "JPN", 392, new[] { "81" }), new CountryPhoneCode("Jersey", "JE", "JEY", 832, new[] { "44 1534" }), new CountryPhoneCode("Jordan", "JO", "JOR", 400, new[] { "962" }), new CountryPhoneCode("Kazakhstan", "KZ", "KAZ", 398, new[] { "7" }), new CountryPhoneCode("Kenya", "KE", "KEN", 404, new[] { "254" }), new CountryPhoneCode("Kiribati", "KI", "KIR", 296, new[] { "686" }), new CountryPhoneCode("Korea (Democratic People's Republic of)", "KP", "PRK", 408, new[] { "850" }), new CountryPhoneCode("Korea (Republic of)", "KR", "KOR", 410, new[] { "82" }), new CountryPhoneCode("Kuwait", "KW", "KWT", 414, new[] { "965" }), new CountryPhoneCode("Kyrgyzstan", "KG", "KGZ", 417, new[] { "996" }), new CountryPhoneCode("Lao People's Democratic Republic", "LA", "LAO", 418, new[] { "856" }), new CountryPhoneCode("Latvia", "LV", "LVA", 428, new[] { "371" }), new CountryPhoneCode("Lebanon", "LB", "LBN", 422, new[] { "961" }), new CountryPhoneCode("Lesotho", "LS", "LSO", 426, new[] { "266" }), new CountryPhoneCode("Liberia", "LR", "LBR", 430, new[] { "231" }), new CountryPhoneCode("Libya", "LY", "LBY", 434, new[] { "218" }), new CountryPhoneCode("Liechtenstein", "LI", "LIE", 438, new[] { "423" }), new CountryPhoneCode("Lithuania", "LT", "LTU", 440, new[] { "370" }), new CountryPhoneCode("Luxembourg", "LU", "LUX", 442, new[] { "352" }), new CountryPhoneCode("Macao", "MO", "MAC", 446, new[] { "853" }), new CountryPhoneCode("Macedonia (the former Yugoslav Republic of)", "MK", "MKD", 807, new[] { "389" }), new CountryPhoneCode("Madagascar", "MG", "MDG", 450, new[] { "261" }), new CountryPhoneCode("Malawi", "MW", "MWI", 454, new[] { "265" }), new CountryPhoneCode("Malaysia", "MY", "MYS", 458, new[] { "60" }), new CountryPhoneCode("Maldives", "MV", "MDV", 462, new[] { "960" }), new CountryPhoneCode("Mali", "ML", "MLI", 466, new[] { "223" }), new CountryPhoneCode("Malta", "MT", "MLT", 470, new[] { "356" }), new CountryPhoneCode("Marshall Islands", "MH", "MHL", 584, new[] { "692" }), new CountryPhoneCode("Martinique", "MQ", "MTQ", 474, new[] { "596" }), new CountryPhoneCode("Mauritania", "MR", "MRT", 478, new[] { "222" }), new CountryPhoneCode("Mauritius", "MU", "MUS", 480, new[] { "230" }), new CountryPhoneCode("Mayotte", "YT", "MYT", 175, new[] { "262" }), new CountryPhoneCode("Mexico", "MX", "MEX", 484, new[] { "52" }), new CountryPhoneCode("Micronesia (Federated States of)", "FM", "FSM", 583, new[] { "691" }), new CountryPhoneCode("Moldova (Republic of)", "MD", "MDA", 498, new[] { "373" }), new CountryPhoneCode("Monaco", "MC", "MCO", 492, new[] { "377" }), new CountryPhoneCode("Mongolia", "MN", "MNG", 496, new[] { "976" }), new CountryPhoneCode("Montenegro", "ME", "MNE", 499, new[] { "382" }), new CountryPhoneCode("Montserrat", "MS", "MSR", 500, new[] { "1 664" }), new CountryPhoneCode("Morocco", "MA", "MAR", 504, new[] { "212" }), new CountryPhoneCode("Mozambique", "MZ", "MOZ", 508, new[] { "258" }), new CountryPhoneCode("Myanmar", "MM", "MMR", 104, new[] { "95" }), new CountryPhoneCode("Namibia", "NA", "NAM", 516, new[] { "264" }), new CountryPhoneCode("Nauru", "NR", "NRU", 520, new[] { "674" }), new CountryPhoneCode("Nepal", "NP", "NPL", 524, new[] { "977" }), new CountryPhoneCode("Netherlands", "NL", "NLD", 528, new[] { "31" }), new CountryPhoneCode("New Caledonia", "NC", "NCL", 540, new[] { "687" }), new CountryPhoneCode("New Zealand", "NZ", "NZL", 554, new[] { "64" }), new CountryPhoneCode("Nicaragua", "NI", "NIC", 558, new[] { "505" }), new CountryPhoneCode("Niger", "NE", "NER", 562, new[] { "227" }), new CountryPhoneCode("Nigeria", "NG", "NGA", 566, new[] { "234" }), new CountryPhoneCode("Niue", "NU", "NIU", 570, new[] { "683" }), new CountryPhoneCode("Norfolk Island", "NF", "NFK", 574, new[] { "672" }), new CountryPhoneCode("Northern Mariana Islands", "MP", "MNP", 580, new[] { "1 670" }), new CountryPhoneCode("Norway", "NO", "NOR", 578, new[] { "47" }), new CountryPhoneCode("Oman", "OM", "OMN", 512, new[] { "968" }), new CountryPhoneCode("Pakistan", "PK", "PAK", 586, new[] { "92" }), new CountryPhoneCode("Palau", "PW", "PLW", 585, new[] { "680" }), new CountryPhoneCode("Palestine, State of", "PS", "PSE", 275, new[] { "970" }), new CountryPhoneCode("Panama", "PA", "PAN", 591, new[] { "507" }), new CountryPhoneCode("Papua New Guinea", "PG", "PNG", 598, new[] { "675" }), new CountryPhoneCode("Paraguay", "PY", "PRY", 600, new[] { "595" }), new CountryPhoneCode("Peru", "PE", "PER", 604, new[] { "51" }), new CountryPhoneCode("Philippines", "PH", "PHL", 608, new[] { "63" }), new CountryPhoneCode("Pitcairn", "PN", "PCN", 612, new[] { "64" }), new CountryPhoneCode("Poland", "PL", "POL", 616, new[] { "48" }), new CountryPhoneCode("Portugal", "PT", "PRT", 620, new[] { "351" }), new CountryPhoneCode("Puerto Rico", "PR", "PRI", 630, new[] { "1 787", "1 939" }), new CountryPhoneCode("Qatar", "QA", "QAT", 634, new[] { "974" }), new CountryPhoneCode("Réunion", "RE", "REU", 638, new[] { "262" }), new CountryPhoneCode("Romania", "RO", "ROU", 642, new[] { "40" }), new CountryPhoneCode("Russian Federation", "RU", "RUS", 643, new[] { "7" }), new CountryPhoneCode("Rwanda", "RW", "RWA", 646, new[] { "250" }), new CountryPhoneCode("Saint Barthélemy", "BL", "BLM", 652, new[] { "590" }), new CountryPhoneCode("Saint Helena, Ascension and Tristan da Cunha", "SH", "SHN", 654, new[] { "290" }), new CountryPhoneCode("Saint Kitts and Nevis", "KN", "KNA", 659, new[] { "1 869" }), new CountryPhoneCode("Saint Lucia", "LC", "LCA", 662, new[] { "1 758" }), new CountryPhoneCode("Saint Martin (French part)", "MF", "MAF", 663, new[] { "590" }), new CountryPhoneCode("Saint Pierre and Miquelon", "PM", "SPM", 666, new[] { "508" }), new CountryPhoneCode("Saint Vincent and the Grenadines", "VC", "VCT", 670, new[] { "1 784" }), new CountryPhoneCode("Samoa", "WS", "WSM", 882, new[] { "685" }), new CountryPhoneCode("San Marino", "SP", "SMR", 674), new CountryPhoneCode("Sao Tome and Principe", "ST", "STP", 678, new[] { "239" }), new CountryPhoneCode("Saudi Arabia", "SA", "SAU", 682, new[] { "966" }), new CountryPhoneCode("Senegal", "SN", "SEN", 686, new[] { "221" }), new CountryPhoneCode("Serbia", "RS", "SRB", 688, new[] { "381" }), new CountryPhoneCode("Seychelles", "SC", "SYC", 690, new[] { "248" }), new CountryPhoneCode("Sierra Leone", "SL", "SLE", 694, new[] { "232" }), new CountryPhoneCode("Singapore", "SG", "SGP", 702, new[] { "65" }), new CountryPhoneCode("Sint Maarten (Dutch part)", "SX", "SXM", 534, new[] { "1 721" }), new CountryPhoneCode("Slovakia", "SK", "SVK", 703, new[] { "421" }), new CountryPhoneCode("Slovenia", "SI", "SVN", 705, new[] { "386" }), new CountryPhoneCode("Solomon Islands", "SB", "SLB", 90, new[] { "677" }), new CountryPhoneCode("Somalia", "SO", "SOM", 706, new[] { "252" }), new CountryPhoneCode("South Africa", "ZA", "ZAF", 710, new[] { "27" }), new CountryPhoneCode("South Georgia and the South Sandwich Islands", "GS", "SGS", 239, new[] { "500" }), new CountryPhoneCode("South Sudan", "SS", "SSD", 728, new[] { "211" }), new CountryPhoneCode("Spain", "ES", "ESP", 724, new[] { "34" }), new CountryPhoneCode("Sri Lanka", "LK", "LKA", 144, new[] { "94" }), new CountryPhoneCode("Sudan", "SD", "SDN", 729, new[] { "249" }), new CountryPhoneCode("Suriname", "SR", "SUR", 740, new[] { "597" }), new CountryPhoneCode("Svalbard and Jan Mayen", "SJ", "SJM", 744, new[] { "47" }), new CountryPhoneCode("Swaziland", "SZ", "SWZ", 748, new[] { "268" }), new CountryPhoneCode("Sweden", "SE", "SWE", 752, new[] { "46" }), new CountryPhoneCode("Switzerland", "CH", "CHE", 756, new[] { "41" }), new CountryPhoneCode("Syrian Arab Republic", "SY", "SYR", 760, new[] { "963" }), new CountryPhoneCode("Taiwan, Province of China[a]", "TW", "TWN", 158, new[] { "886" }), new CountryPhoneCode("Tajikistan", "TJ", "TJK", 762, new[] { "992" }), new CountryPhoneCode("Tanzania, United Republic of", "TZ", "TZA", 834, new[] { "255" }), new CountryPhoneCode("Thailand", "TH", "THA", 764, new[] { "66" }), new CountryPhoneCode("Timor-Leste", "TL", "TLS", 626, new[] { "670" }), new CountryPhoneCode("Togo", "TG", "TGO", 768, new[] { "228" }), new CountryPhoneCode("Tokelau", "TK", "TKL", 772, new[] { "690" }), new CountryPhoneCode("Tonga", "TO", "TON", 776, new[] { "676" }), new CountryPhoneCode("Trinidad and Tobago", "TT", "TTO", 780, new[] { "1 868" }), new CountryPhoneCode("Tunisia", "TN", "TUN", 788, new[] { "216" }), new CountryPhoneCode("Turkey", "TR", "TUR", 792, new[] { "90" }), new CountryPhoneCode("Turkmenistan", "TM", "TKM", 795, new[] { "993" }), new CountryPhoneCode("Turks and Caicos Islands", "TC", "TCA", 796, new[] { "1 649" }), new CountryPhoneCode("Tuvalu", "TV", "TUV", 798, new[] { "688" }), new CountryPhoneCode("Uganda", "UG", "UGA", 800, new[] { "256" }), new CountryPhoneCode("Ukraine", "UA", "UKR", 804, new[] { "380" }), new CountryPhoneCode("United Arab Emirates", "AE", "ARE", 784, new[] { "971" }), new CountryPhoneCode("United Kingdom of Great Britain and Northern Ireland", "GB", "GBR", 826, new[] { "44" }), new CountryPhoneCode("United States of America", "US", "USA", 840, new[] { "1" }), new CountryPhoneCode("United States Minor Outlying Islands", "UM", "UMI", 581), new CountryPhoneCode("Uruguay", "UY", "URY", 858, new[] { "598" }), new CountryPhoneCode("Uzbekistan", "UZ", "UZB", 860, new[] { "998" }), new CountryPhoneCode("Vanuatu", "VU", "VUT", 548, new[] { "678" }), new CountryPhoneCode("Venezuela (Bolivarian Republic of)", "VE", "VEN", 862, new[] { "58" }), new CountryPhoneCode("Viet Nam", "VN", "VNM", 704, new[] { "84" }), new CountryPhoneCode("Virgin Islands (British)", "VG", "VGB", 92, new[] { "1 284" }), new CountryPhoneCode("Virgin Islands (U.S.)", "VI", "VIR", 850, new[] { "1 340" }), new CountryPhoneCode("Wallis and Futuna", "WF", "WLF", 876, new[] { "681" }), new CountryPhoneCode("Western Sahara", "EH", "ESH", 732, new[] { "212" }), new CountryPhoneCode("Yemen", "YE", "YEM", 887, new[] { "967" }), new CountryPhoneCode("Zambia", "ZM", "ZMB", 894, new[] { "260" }), new CountryPhoneCode("Zimbabwe", "ZW", "ZWE", 716, new[] { "263" }) }; } } }