Export (0) Print
Expand All

Names Associated with a RegionInfo Object

There are several variations of a region name associated with RegionInfo. The basic name is represented by Name. The class also supports properties for display name, English name, native name, and others. While there is more than one name that can be used to construct a RegionInfo object, once it is created, there is a single name associated with it. This naming contrasts with the more complicated situation for CultureInfo objects, which is explained in Names Associated with a CultureInfo Object.

Region name handling depends on the constructor used for RegionInfo. The class defines one constructor for which the application passes a region name and one handling the region name using a culture identifier.

When passing a region name to create a RegionInfo object, your application uses the constructor that takes a name string. Let's consider an example in which region name strings for United States and Germany are passed. In .NET Framework version 1.0, the naming is very straightforward and your application specifies:

  • "US" for United States

  • "DE" for Germany

  • Nothing for a custom culture

In .NET Framework version 2.0, strings such as "US" and "DE" continue to work in this context, but another approach is also introduced. Your application can specify a culture name to construct the RegionInfo object, as shown below (only the region portion is relevant). Note that the application also specifies a name for a custom culture.

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

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

  • "fj-FJ", for a custom culture

The following table shows the region naming as handled by System.Globalization.RegionInfo.ToString and System.Globalization.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

System.Globalization.RegionInfo.ToString

US

DE

FJ

System.Globalization.RegionInfo.Name

US

DE

FJ

Your application can also construct a RegionInfo object using the constructor that takes a culture identifier. Let's consider an example in which the culture identifiers passed to the constructor are:

  • 0x0409 for English (United States)

  • 0x0407 for German (Germany)

  • 0x0c00 for custom culture "fj-FJ", which must be the current default user culture

The following table shows the region naming as handled by System.Globalization.RegionInfo.ToString and System.Globalization.RegionInfo.Name. Note that the names are exactly the same as for the previous example.

Method

en-US

de-DE

Custom culture

(culture identifier passed to constructor)

0x0409

0x0407

0x0c00

System.Globalization.RegionInfo.ToString

US

DE

FJ

System.Globalization.RegionInfo.Name

US

DE

FJ

Community Additions

ADD
Show:
© 2014 Microsoft