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
non-culture-specific, as well as in the default OS language. This is
used with non-culture-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 or set the various class instances used
for localization. Calendar,
CompareInfo, DateTimeFormat,
NumberFormat, and TextInfo
return instances of the analogous classes that set their
functionality.
public class CultureInfo : ICloneable, IFormatProvider {
// Public Constructors
public CultureInfo(int culture);
public CultureInfo(int culture, bool useUserOverride);
public CultureInfo(string name);
public CultureInfo(string name, bool useUserOverride);
// Public Static Properties
public static CultureInfo CurrentCulture{get; }
public static CultureInfo CurrentUICulture{get; }
public static CultureInfo InstalledUICulture{get; }
public static CultureInfo InvariantCulture{get; }
// Public Instance Properties
public virtual Calendar Calendar{get; }
public virtual CompareInfo CompareInfo{get; }
public virtual DateTimeFormatInfo DateTimeFormat{set; get; }
public virtual string DisplayName{get; }
public virtual string EnglishName{get; }
public virtual bool IsNeutralCulture{get; }
public bool IsReadOnly{get; }
public virtual int LCID{get; }
public virtual string Name{get; }
public virtual string NativeName{get; }
public virtual NumberFormatInfo NumberFormat{set; get; }
public virtual Calendar[ ] OptionalCalendars{get; }
public virtual CultureInfo Parent{get; }
public virtual TextInfo TextInfo{get; }
public virtual string ThreeLetterISOLanguageName{get; }
public virtual string ThreeLetterWindowsLanguageName{get; }
public virtual string TwoLetterISOLanguageName{get; }
public bool UseUserOverride{get; }
// Public Static Methods
public static CultureInfo CreateSpecificCulture(string name);
public static CultureInfo[ ] GetCultures(CultureTypes types);
public static CultureInfo ReadOnly(CultureInfo ci);
// Public Instance Methods
public void ClearCachedData( );
public virtual object Clone( );
// implements ICloneable
public override bool Equals(object value);
// overrides object
public virtual object GetFormat(Type formatType);
// implements IFormatProvider
public override int GetHashCode( );
// overrides object
public override string ToString( );
// overrides object
}