This topic has not yet been rated - Rate this topic

RegionInfo Class

April 12, 2014

Contains information about a country/region.

System.Object
  System.Globalization.RegionInfo

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)
public class RegionInfo

The RegionInfo type exposes the following members.

  NameDescription
Public methodRegionInfoInitializes a new instance of the RegionInfo class for a particular country/region based on its full culture name.
Top
  NameDescription
Public propertyCurrencySymbolGets the currency symbol associated with the country/region.
Public propertyStatic memberCurrentRegionGets the RegionInfo that represents the country/region used by the current thread.
Public propertyDisplayNameGets the full name of the country/region in the language of the localized version of the .NET Framework.
Public propertyEnglishNameGets the full name of the country/region in English.
Public propertyIsMetricGets a value indicating whether the country/region uses the metric system for measurements.
Public propertyISOCurrencySymbolGets the three-character ISO 4217 currency symbol associated with the country/region.
Public propertyNameGets the name or ISO 3166 two-letter country/region code for the current RegionInfo object.
Public propertyNativeNameGets the name of a country/region formatted in the native language of the country/region.
Public propertyTwoLetterISORegionNameGets the two-letter code defined in ISO 3166 for the country/region.
Top
  NameDescription
Public methodEqualsDetermines whether the specified object is the same as the current RegionInfo object. (Overrides Object.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for the current RegionInfo, suitable for hashing algorithms and data structures, such as a hash table. (Overrides Object.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string containing the culture name or ISO 3166 two-letter country/region code specified for the current RegionInfo. (Overrides Object.ToString().)
Top

In contrast to CultureInfo, RegionInfo does not represent user preferences and does not depend on the user's language or culture.

The RegionInfo name is one of the two-letter codes defined in ISO 3166 for a country/region. Case is not significant. The Name and TwoLetterISORegionName properties retrieve the appropriate codes in uppercase.

NoteNote:

Although a RegionInfo object is identified by a two-letter country/region code, that two-letter code cannot be used to instantiate a new RegionInfo object. Instead, to instantiate a new RegionInfo object, a full culture name must be passed to its class constructor. A full culture name combines a language code with a country or region code, such as "en-US", "zh-Hans", and "eu-ES".

The following is a list of the predefined RegionInfo names that are recognized by this class and other classes in the System.Globalization namespace.

ISO 3166 2-letter code

Country/region

AE

United Arab Emirates

AL

Albania

AM

Armenia

AR

Argentina

AT

Austria

AU

Australia

AZ

Azerbaijan

BE

Belgium

BG

Bulgaria

BH

Bahrain

BN

Brunei

BO

Bolivia

BR

Brazil

BY

Belarus

BZ

Belize

CA

Canada

CB

Caribbean

CH

Switzerland

CL

Chile

CN

China

CO

Colombia

CR

Costa Rica

CZ

Czech Republic

DE

Germany

DK

Denmark

DO

Dominican Republic

DZ

Algeria

EC

Ecuador

EE

Estonia

EG

Egypt

ES

Spain

FI

Finland

FO

Faroe Islands

FR

France

GB

United Kingdom

GE

Georgia

GR

Greece

GT

Guatemala

HK

Hong Kong SAR

HN

Honduras

HR

Croatia

HU

Hungary

ID

Indonesia

IE

Ireland

IL

Israel

IN

India

IQ

Iraq

IR

Iran

IS

Iceland

IT

Italy

JM

Jamaica

JO

Jordan

JP

Japan

KE

Kenya

KG

Kyrgyzstan

KR

Korea

KW

Kuwait

KZ

Kazakhstan

LB

Lebanon

LI

Liechtenstein

LT

Lithuania

LU

Luxembourg

LV

Latvia

LY

Libya

MA

Morocco

MC

Monaco

MK

Macedonia (FYROM)

MN

Mongolia

MO

Macao SAR

MV

Maldives

MX

Mexico

MY

Malaysia

ME

Montenegro

NI

Nicaragua

NL

The Netherlands

NO

Norway

NZ

New Zealand

OM

Oman

PA

Panama

PE

Peru

PH

Philippines

PK

Pakistan

PL

Poland

PR

Puerto Rico

PT

Portugal

PY

Paraguay

QA

Qatar

RO

Romania

RS

Serbia

RU

Russia

SA

Saudi Arabia

SE

Sweden

SG

Singapore

SI

Slovenia

SK

Slovakia

SV

El Salvador

SY

Syria

TH

Thailand

TN

Tunisia

TR

Turkey

TT

Trinidad and Tobago

TW

Taiwan

UA

Ukraine

US

United States

UY

Uruguay

UZ

Uzbekistan

VE

Venezuela

VN

Vietnam

YE

Yemen

ZA

South Africa

ZW

Zimbabwe

The following code example demonstrates several members of the RegionInfo class.


using System;
using System.Globalization;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Display RegionInfo property values.
      RegionInfo myRI1 = new RegionInfo("en-US");
      outputBlock.Text += String.Format("   Name:                         {0}", myRI1.Name) + "\n";
      outputBlock.Text += String.Format("   DisplayName:                  {0}", myRI1.DisplayName) + "\n";
      outputBlock.Text += String.Format("   EnglishName:                  {0}", myRI1.EnglishName) + "\n";
      outputBlock.Text += String.Format("   IsMetric:                     {0}", myRI1.IsMetric) + "\n";
      outputBlock.Text += String.Format("   TwoLetterISORegionName:       {0}", myRI1.TwoLetterISORegionName) + "\n";
      outputBlock.Text += String.Format("   CurrencySymbol:               {0}", myRI1.CurrencySymbol) + "\n";
      outputBlock.Text += String.Format("   ISOCurrencySymbol:            {0}", myRI1.ISOCurrencySymbol) + "\n";
      outputBlock.Text += "\n";

      // Compare this RegionInfo with another RegionInfo.
      RegionInfo myRI2 = new RegionInfo("en-US");
      if (myRI1.Equals(myRI2))
         outputBlock.Text += "The two RegionInfo instances are equal." + "\n";
      else
         outputBlock.Text += "The two RegionInfo instances are NOT equal." + "\n";
   }
}
// The example displays the following output.
//       Name:                         US
//       DisplayName:                  United States
//       EnglishName:                  United States
//       IsMetric:                     False
//       TwoLetterISORegionName:       US
//       CurrencySymbol:               $
//       ISOCurrencySymbol:            USD
// The two RegionInfo instances are equal.


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.