RegionInfo Constructor (Int32)

Initializes a new instance of the RegionInfo class based on the country/region associated with the specified culture identifier.

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

public RegionInfo(
	int culture
)

Parameters

culture
Type: System.Int32

A culture identifier.

ExceptionCondition
ArgumentException

culture specifies either an invariant, custom, or neutral culture.

The culture identifier is mapped to the corresponding National Language Support (NLS) locale identifier. Detailed culture information is defined in the NLS information page at the Go Global Developer Center (http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx.

The name of the new RegionInfo object is the ISO 3166 2-letter code for the country/region, not the 2-letter language and country/region codes. For example, the culture identifier 0x0409 for the English (United States) culture yields a country/region name of "US" instead of the culture name en-US.

The following code example compares two instances of RegionInfo that were created differently.

using System;
using System.Globalization;

public class SamplesRegionInfo  {

   public static void Main()  {

      // Creates a RegionInfo using the ISO 3166 two-letter code.
      RegionInfo myRI1 = new RegionInfo( "US" );

      // Creates a RegionInfo using a CultureInfo.LCID.
      RegionInfo myRI2 = new RegionInfo( new CultureInfo("en-US",false).LCID );

      // Compares the two instances. 
      if ( myRI1.Equals( myRI2 ) )
         Console.WriteLine( "The two RegionInfo instances are equal." );
      else
         Console.WriteLine( "The two RegionInfo instances are NOT equal." );

   }

}

/*
This code produces the following output.

The two RegionInfo instances are equal.

*/

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft