GetCultures Method

CultureInfo.GetCultures Method (CultureTypes)

 

Gets the list of supported cultures filtered by the specified CultureTypes parameter.

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

static member GetCultures : 
        types:CultureTypes -> CultureInfo[]

Parameters

types
Type: System.Globalization.CultureTypes

A bitwise combination of the enumeration values that filter the cultures to retrieve.

Return Value

Type: System.Globalization.CultureInfo[]

An array that contains the cultures specified by the types parameter. The array of cultures is unsorted.

Exception Condition
ArgumentOutOfRangeException

types specifies an invalid combination of CultureTypes values.

The GetCultures method is most commonly called with the types parameter set to the following values:

  • SpecificCultures, which returns all specific cultures.

  • NeutralCultures, which returns all neutral cultures and the invariant culture.

  • AllCultures, which returns all neutral and specific cultures, cultures installed in the Windows system, and custom cultures created by the user.

  • UserCustomCulture, which returns all custom cultures, such as those registered by the CultureAndRegionInfoBuilder class. In versions of Windows before Windows 10, the UserCustomCulture value applies to all user-defined custom cultures. Starting with Windows 10, it applies to system cultures that lack complete cultural data and that do not have a unique local identifier, as indicated by the LCID property value. As a result, code such as the following will return different results when run on Windows 10 and on an earlier version of Windows.

    No code example is currently available or this language may not be supported.

The following code example displays several properties of the neutral cultures.

System_CAPS_noteNote

The example displays the zh-CHS and zh-CHT cultures with the 0x0004 and 0x7C04 culture identifiers, respectively. However, your Windows Vista applications should use the zh-Hans name instead of zh-CHS and the zh-Hant name instead of zh-CHT. The zh-Hans and zh-Hant names represent the current standard, and should be used unless you have a reason for using the older names.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show:
© 2016 Microsoft