Export (0) Print
Expand All

RegionInfo.TwoLetterISORegionName Property

Gets the two-letter code defined in ISO 3166 for the country/region.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

public virtual string TwoLetterISORegionName { get; }

Property Value

Type: System.String
The two-letter code defined in ISO 3166 for the country/region.

The RegionInfo name is one of the two-letter codes defined in ISO 3166 for country/region. For example, the two-letter code for United States is "US".

Important noteImportant

In some cases, the TwoLetterISORegionName property may have more than two characters. For example, the value of the TwoLetterISORegionName property for the Caribbean region is "029".

Case is not significant. However, the Name, the TwoLetterISORegionName, and the ThreeLetterISORegionName properties return the appropriate code in uppercase.

Caution noteCaution

If you want to persist a RegionInfo object or communicate it between processes, you should instantiate it by using a full culture name rather than a two-letter ISO region code. Because RegionInfo properties depend on script and language, instantiating a RegionInfo object by using only a region code loses context and data.

The predefined RegionInfo names are listed in English country names and code elements on the ISO website.

The following code example displays the properties of the RegionInfo class.

using System;
using System.Globalization;

public class SamplesRegionInfo  {

   public static void Main()  {

      // Displays the property values of the RegionInfo for "US".
      RegionInfo myRI1 = new RegionInfo( "US" );
      Console.WriteLine( "   Name:                         {0}", myRI1.Name );
      Console.WriteLine( "   DisplayName:                  {0}", myRI1.DisplayName );
      Console.WriteLine( "   EnglishName:                  {0}", myRI1.EnglishName );
      Console.WriteLine( "   IsMetric:                     {0}", myRI1.IsMetric );
      Console.WriteLine( "   ThreeLetterISORegionName:     {0}", myRI1.ThreeLetterISORegionName );
      Console.WriteLine( "   ThreeLetterWindowsRegionName: {0}", myRI1.ThreeLetterWindowsRegionName );
      Console.WriteLine( "   TwoLetterISORegionName:       {0}", myRI1.TwoLetterISORegionName );
      Console.WriteLine( "   CurrencySymbol:               {0}", myRI1.CurrencySymbol );
      Console.WriteLine( "   ISOCurrencySymbol:            {0}", myRI1.ISOCurrencySymbol );

   }

}

/*
This code produces the following output.

   Name:                         US
   DisplayName:                  United States
   EnglishName:                  United States
   IsMetric:                     False
   ThreeLetterISORegionName:     USA
   ThreeLetterWindowsRegionName: USA
   TwoLetterISORegionName:       US
   CurrencySymbol:               $
   ISOCurrencySymbol:            USD

*/

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft