Export (0) Print
Expand All

CultureTypes Enumeration

Defines the types of culture lists that can be retrieved using CultureInfo.GetCultures.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

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

[SerializableAttribute] 
[ComVisibleAttribute(true)] 
[FlagsAttribute] 
public enum CultureTypes
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
/** @attribute FlagsAttribute() */ 
public enum CultureTypes
SerializableAttribute 
ComVisibleAttribute(true) 
FlagsAttribute 
public enum CultureTypes

 Member nameDescription
Supported by the .NET Compact FrameworkAllCulturesAll cultures that ship with the .NET Framework including neutral and specific cultures, cultures installed in the Windows system, and custom cultures created by the user. 
FrameworkCulturesNeutral and specific cultures shipped with the .NET Framework. 
Supported by the .NET Compact FrameworkInstalledWin32CulturesAll cultures that are installed in the Windows system. Note that not all cultures supported by the .NET Framework are installed in the Windows system. 
Supported by the .NET Compact FrameworkNeutralCulturesCultures that are associated with a language but are not specific to a country/region. The names of .NET Framework cultures consist of the lowercase two-letter code derived from ISO 639-1. For example: "en" (English) is a neutral culture.  

Custom cultures can have any user-specified name, not just a two-letter code.

The invariant culture is included in the array of cultures returned by the CultureInfo.GetCultures method that specifies this value.

The NeutralCultures value is mutually exclusive with the SpecificCultures value.

ReplacementCulturesCustom cultures created by the user that replace cultures shipped with the .NET Framework. 
Supported by the .NET Compact FrameworkSpecificCulturesCultures that are specific to a country/region. The names of these cultures follow the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. For example, "en-US" (English - United States) is a specific culture. 

Custom cultures can have any user-specified name, not just an RFC 1766 standard name.

The NeutralCultures value is mutually exclusive with the SpecificCultures value.

UserCustomCultureCustom cultures created by the user. 
WindowsOnlyCulturesCultures installed in the Windows system but not the .NET Framework.The WindowsOnlyCultures value is mutually exclusive with the FrameworkCultures value. 

These culture type values are returned by the CultureInfo.CultureTypes property, and also serve as a filter that limits which cultures are returned by the CultureInfo.GetCultures method.

For more information on cultures, see CultureInfo.

The following code example demonstrates the CultureTypes enumeration and the CultureTypes property.

// This example demonstrates the CultureTypes enumeration 
// and the CultureInfo.CultureTypes property.

using System;
using System.Globalization;

class Sample 
{
    public static void Main() 
    {
// Create a table of most culture types. 
    CultureTypes[] mostCultureTypes = new CultureTypes[] {
                        CultureTypes.NeutralCultures, 
                        CultureTypes.SpecificCultures, 
                        CultureTypes.InstalledWin32Cultures, 
                        CultureTypes.UserCustomCulture, 
                        CultureTypes.ReplacementCultures, 
                        CultureTypes.FrameworkCultures,
                        CultureTypes.WindowsOnlyCultures
                        };
    CultureInfo[] allCultures;
    CultureTypes combo;

// Get and enumerate all cultures.
    allCultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
    foreach (CultureInfo ci in allCultures)
        {
// Display the name of each culture.
        Console.WriteLine("Culture: {0}", ci.Name);

// Get the culture types of each culture. 
        combo = ci.CultureTypes;

// Display the name of each culture type flag that is set.
        Console.Write("  ");
        foreach (CultureTypes ct in mostCultureTypes)
            if (0 != (ct & combo))
                Console.Write("{0} ", ct);
        Console.WriteLine();
        }
    }
}

/*
The following is a portion of the results produced by this code example.
.
.
.
Culture: syr
  NeutralCultures FrameworkCultures
Culture: div
  NeutralCultures FrameworkCultures
Culture:
  SpecificCultures FrameworkCultures
Culture: ar-SA
  SpecificCultures FrameworkCultures
Culture: bg-BG
  SpecificCultures InstalledWin32Cultures FrameworkCultures
Culture: ca-ES
  SpecificCultures InstalledWin32Cultures FrameworkCultures
Culture: zh-TW
  SpecificCultures FrameworkCultures
.
.
.
*/

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

using System;
using System.Globalization;

public class SamplesCultureInfo  {

   public static void Main()  {

      // Displays several properties of the neutral cultures.
      Console.WriteLine( "CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME" );
      foreach ( CultureInfo ci in CultureInfo.GetCultures( CultureTypes.NeutralCultures ) )  {
         Console.Write( "{0,-7}", ci.Name );
         Console.Write( " {0,-3}", ci.TwoLetterISOLanguageName );
         Console.Write( " {0,-3}", ci.ThreeLetterISOLanguageName );
         Console.Write( " {0,-3}", ci.ThreeLetterWindowsLanguageName );
         Console.Write( " {0,-40}", ci.DisplayName );
         Console.WriteLine( " {0,-40}", ci.EnglishName );
      }

   }

}


/*
This code produces the following output.  This output has been cropped for brevity.

CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME
ar      ar  ara ARA Arabic                                   Arabic
bg      bg  bul BGR Bulgarian                                Bulgarian
ca      ca  cat CAT Catalan                                  Catalan
zh-CHS  zh  zho CHS Chinese (Simplified)                     Chinese (Simplified)
zh-CHT  zh  zho CHT Chinese (Traditional)                    Chinese (Traditional)
cs      cs  ces CSY Czech                                    Czech
da      da  dan DAN Danish                                   Danish
de      de  deu DEU German                                   German
el      el  ell ELL Greek                                    Greek
en      en  eng ENU English                                  English
es      es  spa ESP Spanish                                  Spanish
fi      fi  fin FIN Finnish                                  Finnish

*/

import System.* ;
import System.Globalization.* ;

public class SamplesCultureInfo
{
     public static void main(String[] args)
    {
        // Displays several properties of the neutral cultures.
        Console.WriteLine("CULTURE ISO ISO WIN DISPLAYNAME                  " 
            + "            ENGLISHNAME");
        
        for (int iCtr = 0; 
            iCtr < (CultureInfo.GetCultures(CultureTypes.NeutralCultures).
            length); iCtr++) {
            CultureInfo ci = 
                CultureInfo.GetCultures(CultureTypes.NeutralCultures)[iCtr];
            Console.Write("{0,-7}", ci.get_Name());
            Console.Write(" {0,-3}", ci.get_TwoLetterISOLanguageName());
            Console.Write(" {0,-3}", ci.get_ThreeLetterISOLanguageName());
            Console.Write(" {0,-3}", ci.get_ThreeLetterWindowsLanguageName());
            Console.Write(" {0,-40}", ci.get_DisplayName());
            Console.WriteLine(" {0,-40}", ci.get_EnglishName());
        }
    } //main 
} //SamplesCultureInfo

/*
This code produces the following output.  This output has been cropped 
for brevity.

CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME
ar      ar  ara ARA Arabic                                   Arabic
bg      bg  bul BGR Bulgarian                                Bulgarian
ca      ca  cat CAT Catalan                                  Catalan
zh-CHS  zh  zho CHS Chinese (Simplified)                     Chinese 
(Simplified)
zh-CHT  zh  zho CHT Chinese (Traditional)                    Chinese
(Traditional)
cs      cs  ces CSY Czech                                    Czech
da      da  dan DAN Danish                                   Danish
de      de  deu DEU German                                   German
el      el  ell ELL Greek                                    Greek
en      en  eng ENU English                                  English
es      es  spa ESP Spanish                                  Spanish
fi      fi  fin FIN Finnish                                  Finnish
*/

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft