How to

get ISO name for country/region

Published: 11. October 2011 | Updated: 11. October 2011
License: Microsoft Public License (MS-PL)
Categories: Globalization » Regions
Tags: C# Globalization
Was this snippet helpful for you? YESYES / NONO

Import namespace

using System.Globalization;

Code

var culture = CultureInfo.GetCultureInfo("en-US");
var regionInfo = new RegionInfo(culture.Name);

string iso2 = regionInfo.TwoLetterISORegionName;
Console.WriteLine("Two letter ISO name: {0}", iso2);

string iso3 = regionInfo.ThreeLetterISORegionName;
Console.WriteLine("Three letter ISO name: {0}", iso3);
Console Output:
Two letter ISO name: US
Three letter ISO name: USA
Send us feedback about this snippet »



Related Snippets: