Reputation: 4387
Is there a quick built in way to convert ALPHA-2 (GB) to ALPHA-3 (GBR) in C# without having to create an array of them all.
Upvotes: 4
Views: 1900
Reputation: 177
Sorry for bumping an old thread. This do work for GB but RegionInfo will throw an exception for a lot of ALPHA-2 country codes e.g.
new RegionInfo("AF"); // throws an error for Afghanistan
Upvotes: 0
Reputation: 241711
// using System.Globalization;
RegionInfo info = new RegionInfo("GB");
string ISOAlpha3 = info.ThreeLetterISORegionName; // ISOAlpha3 == "GBR"
Upvotes: 11