CultureInfo Constructor (Int32, Boolean)
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.
Assembly: mscorlib (in mscorlib.dll)
- Type: System.Int32
A predefined CultureInfo identifier, LCID property of an existing CultureInfo object, or Windows-only culture identifier.
- Type: System.Boolean
A Boolean that denotes whether to use the user-selected culture settings (true) or the default culture settings (false).
Predefined culture identifiers are listed 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 use of the locale name constructor CultureInfo.CultureInfo is encouraged, as locale names are preferred to LCIDs. For custom locales the locale name is required.
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.
Applications should typically not disallow user overrides. Note that disallowing overrides does not itself guarantee data stability; see the blog entry "Culture data shouldn't be considered stable (except for Invariant)" (http://blogs.msdn.com/shawnste/archive/2005/04/05/405694.aspx).
If the UseUserOverride property is set to true and the specified culture identifier matches the 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.
Otherwise, this constructor creates a CultureInfo that uses the default values for the specified culture.
The value of the useUserOverride parameter becomes the value of the UseUserOverride property.
For example, suppose that Arabic (Saudi Arabia) is the current culture of Windows 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 set the useUserOverride parameter to false.
For backwards compatibility, a culture constructed using a culture parameter of 0x0004 or 0x7c04 will have a Name property of zh-CHS or zh-CHT, respectively. You should instead prefer to construct the culture using the current standard culture names of zh-Hans or zh-Hant, unless you have a reason for using the older names.
The .NET Framework version 3.5 and earlier versions throw an ArgumentException if culture is not a valid culture identifier. Starting with the .NET Framework version 4, this constructor throws a CultureNotFoundException.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.