Export (0) Print
Expand All

RegionInfo Class

Contains information about a country/region.

System.Object
  System.Globalization.RegionInfo

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

[ComVisibleAttribute(true)]
public class RegionInfo

The RegionInfo type exposes the following members.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360RegionInfoInitializes a new instance of the RegionInfo class for a particular country/region based on its full culture name.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360CurrencySymbolGets the currency symbol associated with the country/region.
Public propertyStatic memberSupported by Silverlight for Windows PhoneSupported by Xbox 360CurrentRegionGets the RegionInfo that represents the country/region used by the current thread.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360DisplayNameGets the full name of the country/region in the language of the localized version of the .NET Framework for Silverlight.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360EnglishNameGets the full name of the country/region in English.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360IsMetricGets a value indicating whether the country/region uses the metric system for measurements.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360ISOCurrencySymbolGets the three-character ISO 4217 currency symbol associated with the country/region.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360NameGets the name or ISO 3166 two-letter country/region code for the current RegionInfo object.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360NativeNameGets the name of a country/region formatted in the native language of the country/region.
Public propertySupported by Silverlight for Windows PhoneSupported by Xbox 360TwoLetterISORegionNameGets the two-letter code defined in ISO 3166 for the country/region.
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360EqualsDetermines whether the specified object is the same as the current RegionInfo object. (Overrides Object.Equals(Object).)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360FinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360GetHashCodeServes as a hash function for the current RegionInfo, suitable for hashing algorithms and data structures, such as a hash table. (Overrides Object.GetHashCode().)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360GetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneSupported by Xbox 360MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360ToStringReturns 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

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.


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

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

Community Additions

ADD
Show:
© 2014 Microsoft