Name
CultureInfo
Synopsis
The CultureInfo
class encapsulates information about handling information
according to the special requirements of a particular culture and language.
Culture information is identified by language and country/region codes as
specified in RFC 1766. For example, U.S. English is identified as en-US
.
The two-letter, lowercase language codes are defined in ISO 639-1. The
two-letter, uppercase region codes are defined in ISO 3166.
The specific CultureInfo
to use at runtime can be found in a number of ways.
The class provides four public properties that return the current CultureInfo
instance. CurrentCulture
returns
the value of Thread.CurrentCulture
,
which is the CultureInfo
used by the current thread. CurrentUICulture
returns the CultureInfo
used by the System.Resources.ResourceManager
.
This can be a user, machine, or application-based locale setting. It is
set in Thread.CurrentUICulture
.
InstalledUICulture
gets the default CultureInfo
used by the ResourceManager
, and
represents the locale of the operating system.
InvariantCulture
returns the CultureInfo
for the invariant locale, which is nonculture-specific, as well as in
the default OS language. This is used with nonculture-specific functions
such as system-level calls.
The instance properties of the class provide a number of ways to retrieve the
culture name. For example, NativeName
gets the culture name
in the language of that culture. LCID
gets the NLS-specified number for a culture name. Other properties ...
Get C# in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.