Partilhar via


Names Associated with a RegionInfo Object 

While there is more than one names that can be used to construct a RegionInfo object, once it is created, there is a single name associated with it. This contrasts with the more complicated situation for CultureInfo objects, which is explained at Names Associated with a CultureInfo Object. .

Constructing a RegionInfo object and accessing its name

First, let us consider three examples in which System.Globalization.RegionInfo.#ctor(System.String) is used to construct a RegionInfo object. In .Net Framework version 1.0, this is very straightforward. For example, you would specify:

  • "US" for United States

  • "DE" for Germany

  • You cannot specify a custom culture.

In .Net Framework version 2.0, strings like "US" and "DE" continue to work in this context, but another approach is also introduced. You could specify a culture name to construct a RegionInfo object; only the region portion is relevant:

  • "en-US" (English - United States) for United States

  • "de-DE" (German - Germany) for Germany

  • This works similarly for a custom culture. For example, if "fj-FJ" is a defined custom culture, you could use that.

Let's look at the values each of these objects will return for RegionInfo.ToString and RegionInfo.Name:

Method en-US De-DE Custom Culture

(region passed to constructor)

US

DE

(N/A)

(culture passed to constructor,

introduced in .Net Framework version 2.0)

en-US

De-DE

fj-FJ

RegionInfo.ToString()

US

DE

FJ

RegionInfo.Name

US

DE

FJ

In short, the region name will be the same regardless of how it is constructed.

In addition, each region has a DisplayName, an EnglishName, a NativeName, a ThreeLetterISORegionName, a ThreeLetterWindowsRegionName, and a TwoLetterISORegionName. All of these are also independent of the method of construction.

Constructing a RegionInfo object by ID

The situation is essentially the same if you construct a RegionInfo object with System.Globalization.RegionInfo.#ctor(System.Int32), and specify a culture identifier. In this case, the culture values passed to the constructor are, respectively:

  • 0x0409 for English - United States

  • 0x0407 for German-Germany

  • 0x0c00 for custom culture "fj-FJ". This will work only if "fj-FJ" is the current default user culture.

These objects will return the exact same names as in the previous example:

Method en-US De-DE Custom Culture

(culture identifier passed to constructor)

0x0409

0x0407

0x0c00

RegionInfo.ToString()

US

DE

FJ

RegionInfo.Name

US

DE

FJ

In short, these and all other names - DisplayName, EnglishName, etc. - will be independent of the method of construction.

See Also

Reference

RegionInfo

Concepts

Names Associated with a CultureInfo Object

Other Resources

Encoding and Localization