Export (0) Print
Expand All

CultureInfo Constructor (Int32)

Initializes a new instance of the CultureInfo class based on the culture specified by the culture identifier.

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

public CultureInfo(
	int culture
)

Parameters

culture
Type: System.Int32

A predefined CultureInfo identifier, LCID property of an existing CultureInfo object, or Windows-only culture identifier.

ExceptionCondition
ArgumentOutOfRangeException

culture is less than zero.

ArgumentException

culture is not a valid culture identifier.

-or-

In .NET Compact Framework applications, culture is not supported by the operating system of the device.

Predefined culture names are defined in the National Language Support (NLS) API Reference at the Go Global Developer Center.

In most cases, 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 LCID property of the new CultureInfo.

The user might choose to override some of the values associated with the current culture of Windows through the regional and language options portion of 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 specified culture identifier matches the culture identifier of the current Windows culture, this constructor creates a CultureInfo that uses those overrides, including user settings for the properties of the DateTimeFormatInfo instance returned by the DateTimeFormat property, and the properties of the NumberFormatInfo instance returned by the NumberFormat property. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the OptionalCalendars) the results of the methods and the values of the properties are undefined.

If the specified culture identifier does not match the identifier of the current Windows culture, this constructor creates a CultureInfo that uses the default values for the specified culture.

The UseUserOverride property is always set to true.

For example, suppose that Arabic (Saudi Arabia) is the current Windows culture and the user has changed the calendar from Hijri to Gregorian.

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 the regional and language options portion of Control Panel, the currency might be incorrect. To use the .NET Framework default setting for the currency, the application should use a CultureInfo constructor overload that accepts a useUserOverride parameter and set it to false.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft