RegionInfo Constructor (String)
Initializes a new instance of the RegionInfo class based on the country/region or specific culture, specified by name.
Assembly: mscorlib (in mscorlib.dll)
- Type: System.String
A string that contains a two-letter code defined in ISO 3166 for country/region.
A string that contains the culture name for a specific culture, custom culture, or Windows-only culture. If the culture name is not in RFC 4646 format, your application should specify the entire culture name instead of just the country/region.
The name parameter is either one of the codes defined for country/region, or a specific, custom, or Windows-only culture name. Case is not significant. However, the Name, the TwoLetterISORegionName, and the ThreeLetterISORegionName properties return the specified code or culture name in uppercase. See further discussion in NIB: Names Associated with a RegionInfo Object.
You should provide the name of a specific culture rather than just a country/region name in the name parameter. For example, en-US for English (United States) or es-US for Spanish (United States) is preferable to US because properties such as NativeName and CurrencyNativeName reflect a specific language. az-Latn-AZ or az-Cyrl-AZ is preferable to AZ because properties such as NativeName, CurrencyNativeName, and CurrencySymbol reflect a specific script. The predefined culture names are listed in the National Language Support (NLS) API Reference at the Go Global Developer Center. Note that a call to this constructor throws an ArgumentException if name is a neutral culture (such as en for English).Notes to Callers
This constructor accepts only specific cultures or country/region codes. However, some neutral culture names are the same as country/region codes. In this case, name is interpreted as a country/region code rather than a neutral culture name, and this constructor does not throw an ArgumentException.
The following code example compares two instances of RegionInfo that were created differently.
The following code example creates instances of RegionInfo using culture names.
.NET FrameworkSupported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
Portable Class LibrarySupported in: Portable Class Library
.NET for Windows Store appsSupported in: Windows 8
.NET for Windows Phone appsSupported 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)