System.Globalization.CultureInfo Class

Assembly: Mscorlib.dll
Namespace: System.Globalization
Summary
Represents information about a specific culture including the names of the culture, the writing system, and the calendar used, as well as access to culture-specific objects that provide methods for common operations, such as formatting dates and sorting strings.
C# Syntax:
[Serializable]
public class CultureInfo : ICloneable, IFormatProvider
Thread Safety
This type is safe for multithreaded operations.
Remarks
The CultureInfo class holds culture-specific information, such as the associated language, sublanguage, country/region, calendar, and cultural conventions. This class also provides access to culture-specific instances of DateTimeFormatInfo, NumberFormatInfo, CompareInfo, and TextInfo. These objects contain the information required for culture-specific operations, such as casing, formatting dates and numbers, and comparing strings.

The String class indirectly uses this class to obtain information about the default culture.

The culture names follow the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. For example, U.S. English is "en-US". Some culture names have prefixes that specify the script; for example, "Cy-" specifies the Cyrillic script, "Lt-" specifies the Latin script.

The following predefined CultureInfo names and identifiers are accepted and used by this class and other classes in the System.Globalization namespace.



Culture Name Culture Identifier Language-Country/Region
"" (empty string) 0x007F invariant culture
af 0x0036 Afrikaans
af-ZA 0x0436 Afrikaans - South Africa
sq 0x001C Albanian
sq-AL 0x041C Albanian - Albania
ar 0x0001 Arabic
ar-DZ 0x1401 Arabic - Algeria
ar-BH 0x3C01 Arabic - Bahrain
ar-EG 0x0C01 Arabic - Egypt
ar-IQ 0x0801 Arabic - Iraq
ar-JO 0x2C01 Arabic - Jordan
ar-KW 0x3401 Arabic - Kuwait
ar-LB 0x3001 Arabic - Lebanon
ar-LY 0x1001 Arabic - Libya
ar-MA 0x1801 Arabic - Morocco
ar-OM 0x2001 Arabic - Oman
ar-QA 0x4001 Arabic - Qatar
ar-SA 0x0401 Arabic - Saudi Arabia
ar-SY 0x2801 Arabic - Syria
ar-TN 0x1C01 Arabic - Tunisia
ar-AE 0x3801 Arabic - United Arab Emirates
ar-YE 0x2401 Arabic - Yemen
hy 0x002B Armenian
hy-AM 0x042B Armenian - Armenia
az 0x002C Azeri
Cy-az-AZ 0x082C Azeri (Cyrillic) - Azerbaijan
Lt-az-AZ 0x042C Azeri (Latin) - Azerbaijan
eu 0x002D Basque
eu-ES 0x042D Basque - Basque
be 0x0023 Belarusian
be-BY 0x0423 Belarusian - Belarus
bg 0x0002 Bulgarian
bg-BG 0x0402 Bulgarian - Bulgaria
ca 0x0003 Catalan
ca-ES 0x0403 Catalan - Catalan
zh-HK 0x0C04 Chinese - Hong Kong SAR
zh-MO 0x1404 Chinese - Macau SAR
zh-CN 0x0804 Chinese - China
zh-CHS 0x0004 Chinese (Simplified)
zh-SG 0x1004 Chinese - Singapore
zh-TW 0x0404 Chinese - Taiwan
zh-CHT 0x7C04 Chinese (Traditional)
hr 0x001A Croatian
hr-HR 0x041A Croatian - Croatia
cs 0x0005 Czech
cs-CZ 0x0405 Czech - Czech Republic
da 0x0006 Danish
da-DK 0x0406 Danish - Denmark
div 0x0065 Dhivehi
div-MV 0x0465 Dhivehi - Maldives
nl 0x0013 Dutch
nl-BE 0x0813 Dutch - Belgium
nl-NL 0x0413 Dutch - The Netherlands
en 0x0009 English
en-AU 0x0C09 English - Australia
en-BZ 0x2809 English - Belize
en-CA 0x1009 English - Canada
en-CB 0x2409 English - Caribbean
en-IE 0x1809 English - Ireland
en-JM 0x2009 English - Jamaica
en-NZ 0x1409 English - New Zealand
en-PH 0x3409 English - Philippines
en-ZA 0x1C09 English - South Africa
en-TT 0x2C09 English - Trinidad and Tobago
en-GB 0x0809 English - United Kingdom
en-US 0x0409 English - United States
en-ZW 0x3009 English - Zimbabwe
et 0x0025 Estonian
et-EE 0x0425 Estonian - Estonia
fo 0x0038 Faroese
fo-FO 0x0438 Faroese - Faroe Islands
fa 0x0029 Farsi
fa-IR 0x0429 Farsi - Iran
fi 0x000B Finnish
fi-FI 0x040B Finnish - Finland
fr 0x000C French
fr-BE 0x080C French - Belgium
fr-CA 0x0C0C French - Canada
fr-FR 0x040C French - France
fr-LU 0x140C French - Luxembourg
fr-MC 0x180C French - Monaco
fr-CH 0x100C French - Switzerland
gl 0x0056 Galician
gl-ES 0x0456 Galician - Galician
ka 0x0037 Georgian
ka-GE 0x0437 Georgian - Georgia
de 0x0007 German
de-AT 0x0C07 German - Austria
de-DE 0x0407 German - Germany
de-LI 0x1407 German - Liechtenstein
de-LU 0x1007 German - Luxembourg
de-CH 0x0807 German - Switzerland
el 0x0008 Greek
el-GR 0x0408 Greek - Greece
gu 0x0047 Gujarati
gu-IN 0x0447 Gujarati - India
he 0x000D Hebrew
he-IL 0x040D Hebrew - Israel
hi 0x0039 Hindi
hi-IN 0x0439 Hindi - India
hu 0x000E Hungarian
hu-HU 0x040E Hungarian - Hungary
is 0x000F Icelandic
is-IS 0x040F Icelandic - Iceland
id 0x0021 Indonesian
id-ID 0x0421 Indonesian - Indonesia
it 0x0010 Italian
it-IT 0x0410 Italian - Italy
it-CH 0x0810 Italian - Switzerland
ja 0x0011 Japanese
ja-JP 0x0411 Japanese - Japan
kn 0x004B Kannada
kn-IN 0x044B Kannada - India
kk 0x003F Kazakh
kk-KZ 0x043F Kazakh - Kazakhstan
kok 0x0057 Konkani
kok-IN 0x0457 Konkani - India
ko 0x0012 Korean
ko-KR 0x0412 Korean - Korea
ky 0x0040 Kyrgyz
ky-KZ 0x0440 Kyrgyz - Kazakhstan
lv 0x0026 Latvian
lv-LV 0x0426 Latvian - Latvia
lt 0x0027 Lithuanian
lt-LT 0x0427 Lithuanian - Lithuania
mk 0x002F Macedonian
mk-MK 0x042F Macedonian - FYROM
ms 0x003E Malay
ms-BN 0x083E Malay - Brunei
ms-MY 0x043E Malay - Malaysia
mr 0x004E Marathi
mr-IN 0x044E Marathi - India
mn 0x0050 Mongolian
mn-MN 0x0450 Mongolian - Mongolia
no 0x0014 Norwegian
nb-NO 0x0414 Norwegian ( Bokmål ) - Norway
nn-NO 0x0814 Norwegian (Nynorsk) - Norway
pl 0x0015 Polish
pl-PL 0x0415 Polish - Poland
pt 0x0016 Portuguese
pt-BR 0x0416 Portuguese - Brazil
pt-PT 0x0816 Portuguese - Portugal
pa 0x0046 Punjabi
pa-IN 0x0446 Punjabi - India
ro 0x0018 Romanian
ro-RO 0x0418 Romanian - Romania
ru 0x0019 Russian
ru-RU 0x0419 Russian - Russia
sa 0x004F Sanskrit
sa-IN 0x044F Sanskrit - India
Cy-sr-SP 0x0C1A Serbian (Cyrillic) - Serbia
Lt-sr-SP 0x081A Serbian (Latin) - Serbia
sk 0x001B Slovak
sk-SK 0x041B Slovak - Slovakia
sl 0x0024 Slovenian
sl-SI 0x0424 Slovenian - Slovenia
es 0x000A Spanish
es-AR 0x2C0A Spanish - Argentina
es-BO 0x400A Spanish - Bolivia
es-CL 0x340A Spanish - Chile
es-CO 0x240A Spanish - Colombia
es-CR 0x140A Spanish - Costa Rica
es-DO 0x1C0A Spanish - Dominican Republic
es-EC 0x300A Spanish - Ecuador
es-SV 0x440A Spanish - El Salvador
es-GT 0x100A Spanish - Guatemala
es-HN 0x480A Spanish - Honduras
es-MX 0x080A Spanish - Mexico
es-NI 0x4C0A Spanish - Nicaragua
es-PA 0x180A Spanish - Panama
es-PY 0x3C0A Spanish - Paraguay
es-PE 0x280A Spanish - Peru
es-PR 0x500A Spanish - Puerto Rico
es-ES 0x0C0A Spanish - Spain
es-UY 0x380A Spanish - Uruguay
es-VE 0x200A Spanish - Venezuela
sw 0x0041 Swahili
sw-KE 0x0441 Swahili - Kenya
sv 0x001D Swedish
sv-FI 0x081D Swedish - Finland
sv-SE 0x041D Swedish - Sweden
syr 0x005A Syriac
syr-SY 0x045A Syriac - Syria
ta 0x0049 Tamil
ta-IN 0x0449 Tamil - India
tt 0x0044 Tatar
tt-RU 0x0444 Tatar - Russia
te 0x004A Telugu
te-IN 0x044A Telugu - India
th 0x001E Thai
th-TH 0x041E Thai - Thailand
tr 0x001F Turkish
tr-TR 0x041F Turkish - Turkey
uk 0x0022 Ukrainian
uk-UA 0x0422 Ukrainian - Ukraine
ur 0x0020 Urdu
ur-PK 0x0420 Urdu - Pakistan
uz 0x0043 Uzbek
Cy-uz-UZ 0x0843 Uzbek (Cyrillic) - Uzbekistan
Lt-uz-UZ 0x0443 Uzbek (Latin) - Uzbekistan
vi 0x002A Vietnamese
vi-VN 0x042A Vietnamese - Vietnam

The culture identifier "0x040A" can be used to create a CultureInfo for "Spanish - Spain" that uses the traditional sort order, instead of the default international sort order (culture identifier "0x0c0a").

The cultures are generally grouped into three sets: the invariant culture, the neutral cultures, and the specific cultures.

The invariant culture is culture-insensitive. You can specify the invariant culture by name using an empty string (""). CultureInfo.InvariantCulture retrieves an instance of the invariant culture. It is associated with the English language but not with any country/region. It can be used in almost any method in the Globalization namespace that requires a culture. The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

A neutral culture is a culture that is associated with a language but not with a country/region. A specific culture is a culture that is associated with a language and a country/region. For example, "fr" is a neutral culture and "fr-FR" is a specific culture. Note that "zh-CHS" (Simplified Chinese) and "zh-CHT" (Traditional Chinese) are neutral cultures.

A DateTimeFormatInfo or a NumberFormatInfo can be created only for the invariant culture or for specific cultures, not for neutral cultures.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

For cultures that use the euro, the .NET Framework and Windows XP set the default currency as euro; however, older versions of Windows do not. Therefore, if the user of an older version of Windows has not changed the currency setting through Regional Options or Regional Settings in Control Panel, the currency might be incorrect. To use the .NET Framework default setting for the currency, use a CultureInfo constructor overload that accepts a useUserOverride parameter and set it to false.

This class implements the ICloneable interface to enable duplication of CultureInfo objects. It also implements IFormatProvider to supply formatting information to applications.

See also:
System.Globalization Namespace | RegionInfo

System.Globalization.CultureInfo Member List:

Public Constructors
ctor #1 Overloaded:
.ctor(int culture)

Initializes a new instance of the CultureInfo class based on the culture specified by the culture identifier.
ctor #2 Overloaded:
.ctor(string name)

Initializes a new instance of the CultureInfo class based on the culture specified by name.
ctor #3 Overloaded:
.ctor(int culture, bool useUserOverride)

Initializes a new instance of the CultureInfo class based on the culture specified by the culture identifier and on the Boolean that specifies whether to use the user-selected culture settings from the system.
ctor #4 Overloaded:
.ctor(string name, bool useUserOverride)

Initializes a new instance of the CultureInfo class based on the culture specified by name and on the Boolean that specifies whether to use the user-selected culture settings from the system.
Public Properties
Calendar Read-only

Gets the default calendar used by the culture.
CompareInfo Read-only

Gets the CompareInfo that defines how to compare strings for the culture.
CurrentCulture Read-only

Gets the CultureInfo that represents the culture used by the current thread.
CurrentUICulture Read-only

Gets the CultureInfo that represents the current culture used by the Resource Manager to look up culture-specific resources at run time.
DateTimeFormat Read-write

Gets or sets a DateTimeFormatInfo that defines the culturally appropriate format of displaying dates and times.
DisplayName Read-only

Gets the culture name in the format "<languagefull> (<country/regionfull>)" in the language of the localized version of .NET Framework.
EnglishName Read-only

Gets the culture name in the format "<languagefull> (<country/regionfull>)" in English.
InstalledUICulture Read-only

Gets the CultureInfo that represents the culture installed with the operating system.
InvariantCulture Read-only

Gets the CultureInfo that is culture-independent (invariant).
IsNeutralCulture Read-only

Gets a value indicating whether the current CultureInfo represents a neutral culture.
IsReadOnly Read-only

Gets a value indicating whether the current CultureInfo is read-only.
LCID Read-only

Gets the culture identifier for the current CultureInfo.
Name Read-only

Gets the culture name in the format "<languagecode2>-<country/regioncode2>".
NativeName Read-only

Gets the culture name in the format "<languagefull> (<country/regionfull>)" in the language that the culture is set to display.
NumberFormat Read-write

Gets or sets a NumberFormatInfo that defines the culturally appropriate format of displaying numbers, currency, and percentage.
OptionalCalendars Read-only

Gets the list of optional calendars that can be used by the culture.
Parent Read-only

Gets the CultureInfo that represents the parent culture of the current CultureInfo.
TextInfo Read-only

Gets the TextInfo that defines the writing system associated with the culture.
ThreeLetterISOLanguageName Read-only

Gets the ISO 639-2 three-letter code for the language of the current CultureInfo.
ThreeLetterWindowsLanguageName Read-only

Gets the three-letter code for the language as defined in the Windows API.
TwoLetterISOLanguageName Read-only

Gets the ISO 639-1 two-letter code for the language of the current CultureInfo.
UseUserOverride Read-only

Gets a value indicating whether the current CultureInfo uses the user-selected culture settings.
Public Methods
ClearCachedData Refreshes cached culture-related information.
Clone Creates a copy of the current CultureInfo.
CreateSpecificCulture Creates a CultureInfo that represents the specific culture that is associated with the specified name.
Equals Overridden:
Determines whether the specified object is the same culture as the current CultureInfo.
GetCultures Gets the list of supported cultures filtered by the specified CultureTypes.
GetFormat Gets an object that defines how to format the specified type.
GetHashCode Overridden:
Serves as a hash function for the current CultureInfo, suitable for use in hashing algorithms and data structures, such as a hash table.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ReadOnly Returns a read-only wrapper around the specified CultureInfo.
ToString Overridden:
Returns a string containing the name of the current CultureInfo in the format "<languagecode2>-<country/regioncode2>".
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Globalization.CultureInfo Member Details

Overloaded ctor #1
Summary
Initializes a new instance of the CultureInfo class based on the culture specified by the culture identifier.
C# Syntax:
public CultureInfo(
   int culture
);
Parameters:

culture

A predefined CultureInfo identifier or the CultureInfo.LCID property of an existing CultureInfo. A predefined CultureInfo identifier or the CultureInfo.LCID property of an existing CultureInfo.

Exceptions
Exception Type Condition
ArgumentOutOfRangeException culture is less than zero.
ArgumentException culture is not a valid culture identifier.
Remarks
The predefined culture identifiers are listed in the CultureInfo class topic.

The culture parameter is mapped to the corresponding National Language Support (NLS) locale identifier. The value of the culture parameter becomes the value of the CultureInfo.LCID property of the new CultureInfo.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. This constructor creates a CultureInfo that uses those overrides and sets the CultureInfo.UseUserOverride property to true.

The properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

For cultures that use the euro, the .NET Framework and Windows XP set the default currency as euro; however, older versions of Windows do not. Therefore, if the user of an older version of Windows has not changed the currency setting through Regional Options or Regional Settings in Control Panel, the currency might be incorrect. To use the .NET Framework default setting for the currency, use a CultureInfo constructor overload that accepts a useUserOverride parameter and set it to false.

See also:
CultureInfo.LCID | CultureInfo.UseUserOverride

Return to top


Overloaded ctor #2
Summary
Initializes a new instance of the CultureInfo class based on the culture specified by name.
C# Syntax:
public CultureInfo(
   string name
);
Parameters:

name

A predefined CultureInfo name or the CultureInfo.Name of an existing CultureInfo. A predefined CultureInfo name or the CultureInfo.Name of an existing CultureInfo.

Exceptions
Exception Type Condition
ArgumentNullException name is null.
ArgumentException name is not a valid culture name.
Remarks
The CultureInfo names follow the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. For example, U.S. English is "en-US". The predefined CultureInfo names are listed in the CultureInfo class topic.

The CultureInfo.LCID property of the new CultureInfo is set to the culture identifier associated with the specified name.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. This constructor creates a CultureInfo that uses those overrides and sets the CultureInfo.UseUserOverride property to true.

The properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

For cultures that use the euro, the .NET Framework and Windows XP set the default currency as euro; however, older versions of Windows do not. Therefore, if the user of an older version of Windows has not changed the currency setting through Regional Options or Regional Settings in Control Panel, the currency might be incorrect. To use the .NET Framework default setting for the currency, use a CultureInfo constructor overload that accepts a useUserOverride parameter and set it to false.

See also:
CultureInfo.LCID | CultureInfo.UseUserOverride | CultureInfo.CreateSpecificCulture

Return to top


Overloaded ctor #3
Summary
Initializes a new instance of the CultureInfo class based on the culture specified by the culture identifier and on the Boolean that specifies whether to use the user-selected culture settings from the system.
C# Syntax:
public CultureInfo(
   int culture,
   bool useUserOverride
);
Parameters:

culture

A predefined CultureInfo identifier or the CultureInfo.LCID property of an existing CultureInfo.

useUserOverride

A Boolean that denotes whether to use the user-selected culture settings (true) or the default culture settings (false).

Exceptions
Exception Type Condition
ArgumentOutOfRangeException culture is less than zero.
ArgumentException culture is not a valid culture identifier.
Remarks
The predefined culture identifiers are listed in the CultureInfo class topic.

The culture parameter is mapped to the corresponding National Language Support (NLS) locale identifier. The value of the culture parameter becomes the value of the CultureInfo.LCID property of the new CultureInfo.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. The useUserOverride parameter denotes whether the current CultureInfo uses those overrides or whether it uses the default values of the culture settings. The value of the useUserOverride parameter becomes the value of the CultureInfo.UseUserOverride property.

If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

For cultures that use the euro, the .NET Framework and Windows XP set the default currency as euro; however, older versions of Windows do not. Therefore, if the user of an older version of Windows has not changed the currency setting through Regional Options or Regional Settings in Control Panel, the currency might be incorrect. To use the .NET Framework default setting for the currency, set the useUserOverride parameter to false.

See also:
CultureInfo.LCID | CultureInfo.UseUserOverride

Return to top


Overloaded ctor #4
Summary
Initializes a new instance of the CultureInfo class based on the culture specified by name and on the Boolean that specifies whether to use the user-selected culture settings from the system.
C# Syntax:
public CultureInfo(
   string name,
   bool useUserOverride
);
Parameters:

name

A predefined CultureInfo name or the CultureInfo.Name of an existing CultureInfo. A predefined CultureInfo name or the CultureInfo.Name of an existing CultureInfo.

useUserOverride

A Boolean that denotes whether to use the user-selected culture settings (true) or the default culture settings (false).

Exceptions
Exception Type Condition
ArgumentNullException name is null.
ArgumentException name is not a valid culture name.
Remarks
The CultureInfo names follow the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. For example, U.S. English is "en-US". The predefined CultureInfo names are listed in the CultureInfo class topic.

The CultureInfo.LCID property of the new CultureInfo is set to the culture identifier associated with the specified name.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. The useUserOverride parameter denotes whether the current CultureInfo uses those overrides or whether it uses the default values of the culture settings. The value of the useUserOverride parameter becomes the value of the CultureInfo.UseUserOverride property.

If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

For cultures that use the euro, the .NET Framework and Windows XP set the default currency as euro; however, older versions of Windows do not. Therefore, if the user of an older version of Windows has not changed the currency setting through Regional Options or Regional Settings in Control Panel, the currency might be incorrect. To use the .NET Framework default setting for the currency, set the useUserOverride parameter to false.

See also:
CultureInfo.LCID | CultureInfo.UseUserOverride | CultureInfo.CreateSpecificCulture

Return to top


Property: Calendar (read-only)
Summary
Gets the default calendar used by the culture.
C# Syntax:
public virtual Calendar Calendar {get;}
Remarks
The CultureInfo.DateTimeFormat property is an instance of the DateTimeFormatInfo class that includes properties that allow users to customize the date and time formatting associated with a specific Calendar.
See also:
Calendar | CultureInfo.DateTimeFormat | DateTimeFormatInfo

Return to top


Property: CompareInfo (read-only)
Summary
Gets the CompareInfo that defines how to compare strings for the culture.
C# Syntax:
public virtual CompareInfo CompareInfo {get;}
See also:
CompareInfo

Return to top


Property: CurrentCulture (read-only)
Summary
Gets the CultureInfo that represents the culture used by the current thread.
C# Syntax:
public static CultureInfo CurrentCulture {get;}
Remarks
The culture is a property of the executing thread. This read-only property returns Thread.CurrentCulture. When a thread is started, its culture is initially determined by using GetUserDefaultLCID from the Windows API. To change the culture used by a thread, set Thread.CurrentCulture to the new culture.
See also:
ResourceManager | Thread.CurrentCulture | CultureInfo.CurrentUICulture | CultureInfo.InstalledUICulture | CultureInfo.InvariantCulture | CultureInfo.Parent

Return to top


Property: CurrentUICulture (read-only)
Summary
Gets the CultureInfo that represents the current culture used by the Resource Manager to look up culture-specific resources at run time.
C# Syntax:
public static CultureInfo CurrentUICulture {get;}
Remarks
The culture is a property of the executing thread. This property returns Thread.CurrentUICulture. When a thread is started, its UI culture is initially determined by using GetUserDefaultUILanguage from the Windows API. To change the UI culture used by a thread, set Thread.CurrentUICulture to the new culture.
See also:
ResourceManager | Thread.CurrentUICulture | CultureInfo.CurrentCulture | CultureInfo.InstalledUICulture | CultureInfo.InvariantCulture | CultureInfo.Parent

Return to top


Property: DateTimeFormat (read-write)
Summary
Gets or sets a DateTimeFormatInfo that defines the culturally appropriate format of displaying dates and times.
C# Syntax:
public virtual DateTimeFormatInfo DateTimeFormat {get; set;}
Exceptions
Exception Type Condition
ArgumentNullException The property is set to null.
Remarks
A DateTimeFormatInfo can be created only for the invariant culture or for specific cultures, not for neutral cultures.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

The cultures are generally grouped into three sets: the invariant culture, the neutral cultures, and the specific cultures.

The invariant culture is culture-insensitive. You can specify the invariant culture by name using an empty string (""). CultureInfo.InvariantCulture retrieves an instance of the invariant culture. It is associated with the English language but not with any country/region. It can be used in almost any method in the Globalization namespace that requires a culture. The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

A neutral culture is a culture that is associated with a language but not with a country/region. A specific culture is a culture that is associated with a language and a country/region. For example, "fr" is a neutral culture and "fr-FR" is a specific culture. Note that "zh-CHS" (Simplified Chinese) and "zh-CHT" (Traditional Chinese) are neutral cultures.

See also:
DateTimeFormatInfo | CultureInfo.GetFormat | CultureInfo.NumberFormat

Return to top


Property: DisplayName (read-only)
Summary
Gets the culture name in the format "<languagefull> (<country/regionfull>)" in the language of the localized version of .NET Framework.
C# Syntax:
public virtual string DisplayName {get;}
Remarks
For example, if the .NET Framework English version is installed, the CultureInfo.DisplayName for the specific culture U.S. English is "English (United States)". If the .NET Framework Spanish version is installed, regardless of the language that the system is set to display, the culture name is displayed in Spanish; therefore, the CultureInfo.DisplayName for the specific culture U.S. English is "Ingles (Estados Unidos)".
See also:
CultureInfo.Name | CultureInfo.NativeName | CultureInfo.EnglishName | CultureInfo.TwoLetterISOLanguageName | CultureInfo.ThreeLetterISOLanguageName | CultureInfo.ThreeLetterWindowsLanguageName

Return to top


Property: EnglishName (read-only)
Summary
Gets the culture name in the format "<languagefull> (<country/regionfull>)" in English.
C# Syntax:
public virtual string EnglishName {get;}
Remarks
For example, the CultureInfo.EnglishName for the specific culture U.S. English is "English (United States)".
See also:
CultureInfo.Name | CultureInfo.DisplayName | CultureInfo.NativeName | CultureInfo.TwoLetterISOLanguageName | CultureInfo.ThreeLetterISOLanguageName | CultureInfo.ThreeLetterWindowsLanguageName

Return to top


Property: InstalledUICulture (read-only)
Summary
Gets the CultureInfo that represents the culture installed with the operating system.
C# Syntax:
public static CultureInfo InstalledUICulture {get;}
Remarks
In a localized operating system, such as Japanese Windows 2000 Professional, this property returns the culture of the operating system. This property is the equivalent of GetSystemDefaultUILanguage in the Windows API.
See also:
ResourceManager | CultureInfo.CurrentCulture | CultureInfo.CurrentUICulture | CultureInfo.InvariantCulture | CultureInfo.Parent

Return to top


Property: InvariantCulture (read-only)
Summary
Gets the CultureInfo that is culture-independent (invariant).
C# Syntax:
public static CultureInfo InvariantCulture {get;}
Remarks
The invariant culture is culture-insensitive. You can specify the invariant culture by name using an empty string (""). CultureInfo.InvariantCulture retrieves an instance of the invariant culture. It is associated with the English language but not with any country/region. It can be used in almost any method in the Globalization namespace that requires a culture. The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.
See also:
CultureInfo.CurrentCulture | CultureInfo.CurrentUICulture | CultureInfo.InstalledUICulture | CultureInfo.Parent | CultureInfo.IsNeutralCulture

Return to top


Property: IsNeutralCulture (read-only)
Summary
Gets a value indicating whether the current CultureInfo represents a neutral culture.
C# Syntax:
public virtual bool IsNeutralCulture {get;}
Remarks
A neutral culture is a culture that is associated with a language but not with a country/region. A specific culture is a culture that is associated with a language and a country/region. For example, "fr" is a neutral culture and "fr-FR" is a specific culture. Note that "zh-CHS" (Simplified Chinese) and "zh-CHT" (Traditional Chinese) are neutral cultures.

If this property returns false, the culture is either a specific culture or the invariant culture.

See also:
CultureInfo.InvariantCulture

Return to top


Property: IsReadOnly (read-only)
Summary
Gets a value indicating whether the current CultureInfo is read-only.
C# Syntax:
public bool IsReadOnly {get;}
See also:
CultureInfo.ReadOnly

Return to top


Property: LCID (read-only)
Summary
Gets the culture identifier for the current CultureInfo.
C# Syntax:
public virtual int LCID {get;}
Remarks
The culture identifier is mapped to the corresponding National Language Support (NLS) locale identifier.

Return to top


Property: Name (read-only)
Summary
Gets the culture name in the format "<languagecode2>-<country/regioncode2>".
C# Syntax:
public virtual string Name {get;}
Remarks
The CultureInfo.Name property follows the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. For example, the CultureInfo.Name for the specific culture U.S. English is "en-US".

If the culture is a neutral culture, its CultureInfo.Name is in the format "<languagecode2>". For example, the CultureInfo.Name for the neutral culture English is "en".

The predefined CultureInfo names are listed in the CultureInfo class topic.

To get the full name of the culture, use CultureInfo.DisplayName, CultureInfo.EnglishName, or CultureInfo.NativeName.

See also:
CultureInfo.DisplayName | CultureInfo.NativeName | CultureInfo.EnglishName | CultureInfo.TwoLetterISOLanguageName | CultureInfo.ThreeLetterISOLanguageName | CultureInfo.ThreeLetterWindowsLanguageName

Return to top


Property: NativeName (read-only)
Summary
Gets the culture name in the format "<languagefull> (<country/regionfull>)" in the language that the culture is set to display.
C# Syntax:
public virtual string NativeName {get;}
Remarks
The culture's full name might not display properly if the system is not set to display the culture's language correctly. For example, if the CultureInfo.Name is "ja-JP" for Japanese (Japan), CultureInfo.NativeName does not display correctly on a system that is set to English only. However, multilingual operating systems, such as Windows 2000, display CultureInfo.NativeName correctly.
See also:
CultureInfo.Name | CultureInfo.DisplayName | CultureInfo.EnglishName | CultureInfo.TwoLetterISOLanguageName | CultureInfo.ThreeLetterISOLanguageName | CultureInfo.ThreeLetterWindowsLanguageName

Return to top


Property: NumberFormat (read-write)
Summary
Gets or sets a NumberFormatInfo that defines the culturally appropriate format of displaying numbers, currency, and percentage.
C# Syntax:
public virtual NumberFormatInfo NumberFormat {get; set;}
Exceptions
Exception Type Condition
ArgumentNullException The property is set to null.
Remarks
A NumberFormatInfo can be created only for the invariant culture or for specific cultures, not for neutral cultures.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

The cultures are generally grouped into three sets: the invariant culture, the neutral cultures, and the specific cultures.

The invariant culture is culture-insensitive. You can specify the invariant culture by name using an empty string (""). CultureInfo.InvariantCulture retrieves an instance of the invariant culture. It is associated with the English language but not with any country/region. It can be used in almost any method in the Globalization namespace that requires a culture. The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

A neutral culture is a culture that is associated with a language but not with a country/region. A specific culture is a culture that is associated with a language and a country/region. For example, "fr" is a neutral culture and "fr-FR" is a specific culture. Note that "zh-CHS" (Chinese Simplified) and "zh-CHT" (Traditional Chinese) are neutral cultures.

See also:
NumberFormatInfo | CultureInfo.GetFormat | CultureInfo.DateTimeFormat

Return to top


Property: OptionalCalendars (read-only)
Summary
Gets the list of optional calendars that can be used by the culture.
C# Syntax:
public virtual Calendar[] OptionalCalendars {get;}
Remarks
Optional calendars are other calendars that can be used with the culture represented by the current CultureInfo.

The CultureInfo.DateTimeFormat property is an instance of the DateTimeFormatInfo class that includes properties that allow users to customize the date and time formatting associated with a specific Calendar.

See also:
Calendar | CultureInfo.DateTimeFormat | DateTimeFormatInfo

Return to top


Property: Parent (read-only)
Summary
Gets the CultureInfo that represents the parent culture of the current CultureInfo.
C# Syntax:
public virtual CultureInfo Parent {get;}
Remarks
A parent culture is a higher-level culture that encompasses only the set of information that is common among its children. For example, the parent culture of "en-US" is "en"; the parent culture of "en" is the invariant culture.
See also:
CultureInfo.#ctor | CultureInfo.CurrentCulture | CultureInfo.CurrentUICulture | CultureInfo.InstalledUICulture | CultureInfo.InvariantCulture

Return to top


Property: TextInfo (read-only)
Summary
Gets the TextInfo that defines the writing system associated with the culture.
C# Syntax:
public virtual TextInfo TextInfo {get;}
Remarks
The CultureInfo.TextInfo property provides culture-specific casing information for strings.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

See also:
TextInfo

Return to top


Property: ThreeLetterISOLanguageName (read-only)
Summary
Gets the ISO 639-2 three-letter code for the language of the current CultureInfo.
C# Syntax:
public virtual string ThreeLetterISOLanguageName {get;}
Remarks
For example, the three-letter abbreviation for English is "eng".
See also:
CultureInfo.Name | CultureInfo.DisplayName | CultureInfo.NativeName | CultureInfo.EnglishName | CultureInfo.TwoLetterISOLanguageName | CultureInfo.ThreeLetterWindowsLanguageName

Return to top


Property: ThreeLetterWindowsLanguageName (read-only)
Summary
Gets the three-letter code for the language as defined in the Windows API.
C# Syntax:
public virtual string ThreeLetterWindowsLanguageName {get;}
Remarks
For example, the three-letter code for English (U.S.) as defined in the Windows API is "enu".
See also:
CultureInfo.Name | CultureInfo.DisplayName | CultureInfo.NativeName | CultureInfo.EnglishName | CultureInfo.TwoLetterISOLanguageName | CultureInfo.ThreeLetterISOLanguageName

Return to top


Property: TwoLetterISOLanguageName (read-only)
Summary
Gets the ISO 639-1 two-letter code for the language of the current CultureInfo.
C# Syntax:
public virtual string TwoLetterISOLanguageName {get;}
Remarks
For example, the two-letter abbreviation for English is "en".
See also:
CultureInfo.Name | CultureInfo.DisplayName | CultureInfo.NativeName | CultureInfo.EnglishName | CultureInfo.ThreeLetterISOLanguageName | CultureInfo.ThreeLetterWindowsLanguageName

Return to top


Property: UseUserOverride (read-only)
Summary
Gets a value indicating whether the current CultureInfo uses the user-selected culture settings.
C# Syntax:
public bool UseUserOverride {get;}
Remarks
The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format. This property denotes whether the current CultureInfo uses those overrides (true) or whether it uses the default values (false) of the culture settings.

If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

This property is set when the CultureInfo object is created.

Return to top


Method: ClearCachedData()
Summary
Refreshes cached culture-related information.
C# Syntax:
public void ClearCachedData();
Remarks
Information, such as the default culture and format patterns, is cached the first time it is requested. However, that information can change during the life of the AppDomain, for example, when the user modifies Regional and Language Options (or Regional Options or Regional Settings) in Control Panel in Windows. The CultureInfo class does not detect changes in the system settings automatically. Use the CultureInfo.ClearCachedData method to refresh that information in the CultureInfo class, based on the current system settings.

Return to top


Method: Clone()
Summary
Creates a copy of the current CultureInfo.
C# Syntax:
public virtual object Clone();
Return Value:
A copy of the current CultureInfo.
Implements:
ICloneable.Clone
Remarks
The clone is writable even if the original CultureInfo is read-only; therefore, the properties of the clone can be modified.

A shallow copy of an object is a copy of the object only. If the object contains references to other objects, the shallow copy does not create copies of the referred objects. It refers to the original objects instead. In contrast, a deep copy of an object creates a copy of the object and a copy of everything directly or indirectly referenced by that object.

CultureInfo.Clone is a shallow copy with exceptions. The objects returned by the CultureInfo.NumberFormat and the CultureInfo.DateTimeFormat properties are also cloned, so that the CultureInfo clone can modify the properties of CultureInfo.NumberFormat and CultureInfo.DateTimeFormat without affecting the original CultureInfo.

See also:
Object

Return to top


Method: CreateSpecificCulture(
   string name
)
Summary
Creates a CultureInfo that represents the specific culture that is associated with the specified name.
C# Syntax:
public static CultureInfo CreateSpecificCulture(
   string name
);
Parameters:

name

A predefined CultureInfo name or the name of an existing CultureInfo. A predefined CultureInfo name or the name of an existing CultureInfo.

Return Value:
A CultureInfo that represents the invariant culture, if name is "" (invariant culture).

-or-

A CultureInfo that represents the default specific culture associated with name, if name is a neutral culture.

-or-

A CultureInfo that represents name, if name is already a specific culture.

Exceptions
Exception Type Condition
ArgumentNullException name is null.
ArgumentException name is not a valid culture name.

-or-

The culture specified by name does not have a specific culture associated with it. For example: "zh-CHS" or "zh-CHT".

Remarks
The cultures are generally grouped into three sets: the invariant culture, the neutral cultures, and the specific cultures.

The invariant culture is culture-insensitive. You can specify the invariant culture by name using an empty string (""). CultureInfo.InvariantCulture retrieves an instance of the invariant culture. It is associated with the English language but not with any country/region. It can be used in almost any method in the Globalization namespace that requires a culture. The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

A neutral culture is a culture that is associated with a language but not with a country/region. A specific culture is a culture that is associated with a language and a country/region. For example, "fr" is a neutral culture and "fr-FR" is a specific culture. Note that "zh-CHS" (Simplified Chinese) and "zh-CHT" (Traditional Chinese) are neutral cultures.

See also:
CultureInfo.#ctor

Return to top


Overridden Method: Equals(
   object value
)
Summary
Determines whether the specified object is the same culture as the current CultureInfo.
C# Syntax:
public override bool Equals(
   object value
);
Parameters:

value

The object to compare with the current CultureInfo.

Return Value:
true if value is the same culture as the current CultureInfo; otherwise, false.
Remarks
This method overrides Object.Equals.
See also:
Object.Equals

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~CultureInfo();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetCultures(
   CultureTypes types
)
Summary
Gets the list of supported cultures filtered by the specified CultureTypes.
C# Syntax:
public static CultureInfo[] GetCultures(
   CultureTypes types
);
Parameters:

types

A combination of CultureTypes values that filter the cultures to retrieve.

Return Value:
An array of type CultureInfo that represents the supported cultures filtered by the specified CultureTypes values.
Remarks
Setting types to the CultureTypes.SpecificCultures value returns all specific cultures only. Setting types to the CultureTypes.NeutralCultures value returns all neutral cultures and the invariant culture. Setting types to the CultureTypes.AllCultures value returns all specific cultures, all neutral cultures, and the invariant culture.
See also:
CultureTypes

Return to top


Method: GetFormat(
   Type formatType
)
Summary
Gets an object that defines how to format the specified type.
C# Syntax:
public virtual object GetFormat(
   Type formatType
);
Parameters:

formatType

The Type for which to get a formatting object. This method only supports the NumberFormatInfo and DateTimeFormatInfo types.

Return Value:
A NumberFormatInfo object containing the default number format information for the current CultureInfo, if formatType is the Type object for the NumberFormatInfo class.

-or-

A DateTimeFormatInfo object containing the default date and time format information for the current CultureInfo, if formatType is the Type object for the DateTimeFormatInfo class.

-or-

null, if formatType is any other object.

Implements:
IFormatProvider.GetFormat
Remarks
CultureInfo.GetFormat implements IFormatProvider.GetFormat.

NumberFormatInfo provides the culture-specific numeric format used in conjunction with the Format methods in the base data types.DateTimeFormatInfo controls how the date and time values are formatted for a specific culture.

See also:
Type | NumberFormatInfo | DateTimeFormatInfo | CultureInfo.NumberFormat | CultureInfo.DateTimeFormat

Return to top


Overridden Method: GetHashCode()
Summary
Serves as a hash function for the current CultureInfo, suitable for use in hashing algorithms and data structures, such as a hash table.
C# Syntax:
public override int GetHashCode();
Return Value:
A hash code for the current CultureInfo.
Remarks
This method overrides Object.GetHashCode.

This method generates the same hash code for two objects that are equal according to the CultureInfo.Equals method.

See also:
Object.GetHashCode | Hashtable | CultureInfo.Equals

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ReadOnly(
   CultureInfo ci
)
Summary
Returns a read-only wrapper around the specified CultureInfo.
C# Syntax:
public static CultureInfo ReadOnly(
   CultureInfo ci
);
Parameters:

ci

The CultureInfo to wrap.

Return Value:
A read-only CultureInfo wrapper around ci.
Exceptions
Exception Type Condition
ArgumentNullException ci is null.
Remarks
This wrapper prevents any modifications to ci, to the ci. CultureInfo.DateTimeFormat instance, or to the ci. CultureInfo.NumberFormat instance.
See also:
CultureInfo.IsReadOnly

Return to top


Overridden Method: ToString()
Summary
Returns a string containing the name of the current CultureInfo in the format "<languagecode2>-<country/regioncode2>".
C# Syntax:
public override string ToString();
Return Value:
A string containing the name of the current CultureInfo in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166.
Remarks
This method overrides Object.ToString.

This method returns the value of the CultureInfo.Name property. The CultureInfo names follow the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. For example, U.S. English is "en-US". The predefined CultureInfo names are listed in the CultureInfo class topic.

See also:
Object.ToString | CultureInfo.Name

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.