CultureTypes CultureTypes CultureTypes CultureTypes Enum

Definizione

Definisce i tipi di elenchi di impostazioni cultura che possono essere recuperati tramite il metodo GetCultures(CultureTypes).Defines the types of culture lists that can be retrieved using the GetCultures(CultureTypes) method.

Questa enumerazione ha un attributo FlagsAttribute che consente una combinazione bit per bit dei valori del relativo membro.

public enum class CultureTypes
[System.Flags]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum CultureTypes
type CultureTypes = 
Public Enum CultureTypes
Ereditarietà
Attributi

Campi

AllCultures AllCultures AllCultures AllCultures 7

Tutte le impostazioni cultura riconosciute da .NET, comprese impostazioni cultura specifiche e non associate ad alcun paese e impostazioni cultura personalizzate create dall'utente.All cultures that recognized by .NET, including neutral and specific cultures and custom cultures created by the user.

In .NET Framework 4 e versioni successive e in .NET Core in esecuzione su Windows include i dati delle impostazioni cultura disponibili nel sistema operativo Windows.On .NET Framework 4 and later versions and .NET Core running on Windows, it includes the culture data available from the Windows operating system. In .NET Core in esecuzione su Linux e macOS include i dati delle impostazioni cultura definiti nelle librerie ICU.On .NET Core running on Linux and macOS, it includes culture data defined in the ICU libraries.

AllCultures è un campo composito che include i valori NeutralCultures, SpecificCultures e InstalledWin32Cultures.AllCultures is a composite field that includes the NeutralCultures, SpecificCultures, and InstalledWin32Cultures values.

FrameworkCultures FrameworkCultures FrameworkCultures FrameworkCultures 64

Questo membro è deprecato. Se si usa questo valore con GetCultures(CultureTypes), vengono restituite le impostazioni cultura specifiche e non associate ad alcun paese fornite con .NET Framework 2.0.This member is deprecated; using this value with GetCultures(CultureTypes) returns neutral and specific cultures shipped with the .NET Framework 2.0.

InstalledWin32Cultures InstalledWin32Cultures InstalledWin32Cultures InstalledWin32Cultures 4

Questo membro è deprecato.This member is deprecated. Tutte le impostazioni cultura installate nel sistema operativo Windows.All cultures that are installed in the Windows operating system.

NeutralCultures NeutralCultures NeutralCultures NeutralCultures 1

Impostazioni cultura associate a una lingua ma non specifiche di un paese o di un'area geografica.Cultures that are associated with a language but are not specific to a country/region.

ReplacementCultures ReplacementCultures ReplacementCultures ReplacementCultures 16

Questo membro è deprecato.This member is deprecated. Impostazioni cultura personalizzate create dall'utente che sostituiscono le impostazioni cultura fornite con .NET Framework.Custom cultures created by the user that replace cultures shipped with the .NET Framework.

SpecificCultures SpecificCultures SpecificCultures SpecificCultures 2

Impostazioni cultura specifiche di un paese/area geografica.Cultures that are specific to a country/region.

UserCustomCulture UserCustomCulture UserCustomCulture UserCustomCulture 8

Questo membro è deprecato.This member is deprecated. Impostazioni cultura personalizzate create dall'utente.Custom cultures created by the user.

WindowsOnlyCultures WindowsOnlyCultures WindowsOnlyCultures WindowsOnlyCultures 32

Questo membro è deprecato e viene ignorato.This member is deprecated and is ignored.

Esempi

Nell'esempio seguente viene illustrato il CultureTypes.AllCultures membro dell'enumerazione e CultureTypes proprietà.The following example demonstrates the CultureTypes.AllCultures enumeration member and the CultureTypes property.

using System;
using System.Globalization;

class Sample
{
    public static void Main()
    {
        // Get and enumerate all cultures.
        var allCultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
        foreach (var ci in allCultures)
        {
            // Display the name of each culture.
            Console.Write($"{ci.EnglishName} ({ci.Name}): ");
            // Indicate the culture type.
            if (ci.CultureTypes.HasFlag(CultureTypes.NeutralCultures))
               Console.Write(" NeutralCulture");
            if (ci.CultureTypes.HasFlag(CultureTypes.SpecificCultures))
               Console.Write(" SpecificCulture");
            Console.WriteLine();         
        }
    }
}
/*
The following is a portion of the output from this example.
      Tajik (tg):  NeutralCulture
      Tajik (Cyrillic) (tg-Cyrl):  NeutralCulture
      Tajik (Cyrillic, Tajikistan) (tg-Cyrl-TJ):  SpecificCulture
      Thai (th):  NeutralCulture
      Thai (Thailand) (th-TH):  SpecificCulture
      Tigrinya (ti):  NeutralCulture
      Tigrinya (Eritrea) (ti-ER):  SpecificCulture
      Tigrinya (Ethiopia) (ti-ET):  SpecificCulture
      Tigre (tig):  NeutralCulture
      Tigre (Eritrea) (tig-ER):  SpecificCulture
      Turkmen (tk):  NeutralCulture
      Turkmen (Turkmenistan) (tk-TM):  SpecificCulture
      Setswana (tn):  NeutralCulture
      Setswana (Botswana) (tn-BW):  SpecificCulture
      Setswana (South Africa) (tn-ZA):  SpecificCulture
*/
Imports System.Globalization

Module Module1
    Public Sub Main()
        ' Get and enumerate all cultures.
        Dim allCultures = CultureInfo.GetCultures(CultureTypes.AllCultures)
         For Each ci In allCultures
            ' Display the name of each culture.
            Console.Write($"{ci.EnglishName} ({ci.Name}): ")
            ' Indicate the culture type. 
            If ci.CultureTypes.HasFlag(CultureTypes.NeutralCultures) Then
               Console.Write(" NeutralCulture")
            End If   
            If ci.CultureTypes.HasFlag(CultureTypes.SpecificCultures) Then
               Console.Write(" SpecificCulture")
            End If   
            Console.WriteLine()
        Next
    End Sub  
End Module
' The following is a portion of the output from this example.
'            Tajik (tg):  NeutralCulture
'            Tajik (Cyrillic) (tg-Cyrl):  NeutralCulture
'            Tajik (Cyrillic, Tajikistan) (tg-Cyrl-TJ):  SpecificCulture
'            Thai (th):  NeutralCulture
'            Thai (Thailand) (th-TH):  SpecificCulture
'            Tigrinya (ti):  NeutralCulture
'            Tigrinya (Eritrea) (ti-ER):  SpecificCulture
'            Tigrinya (Ethiopia) (ti-ET):  SpecificCulture
'            Tigre (tig):  NeutralCulture
'            Tigre (Eritrea) (tig-ER):  SpecificCulture
'            Turkmen (tk):  NeutralCulture
'            Turkmen (Turkmenistan) (tk-TM):  SpecificCulture
'            Setswana (tn):  NeutralCulture
'            Setswana (Botswana) (tn-BW):  SpecificCulture
'            Setswana (South Africa) (tn-ZA):  SpecificCulture

L'esempio seguente mostra diverse proprietà delle impostazioni cultura neutre.The following example displays several properties of the neutral cultures.

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Displays several properties of the neutral cultures.
   Console::WriteLine( "CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME" );
   System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::NeutralCultures )->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      CultureInfo^ ci = safe_cast<CultureInfo^>(enum0->Current);
      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-Hans zh  zho CHS Chinese (Simplified)                     Chinese (Simplified)                    
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                                 
zh      zh  zho CHS Chinese                                  Chinese                                 
zh-Hant zh  zho CHT Chinese (Traditional)                    Chinese (Traditional)                   
zh-CHS  zh  zho CHS Chinese (Simplified) Legacy              Chinese (Simplified) Legacy             
zh-CHT  zh  zho CHT Chinese (Traditional) Legacy             Chinese (Traditional) Legacy            

*/
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-Hans zh  zho CHS Chinese (Simplified)                     Chinese (Simplified)                    
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                                 
zh      zh  zho CHS Chinese                                  Chinese                                 
zh-Hant zh  zho CHT Chinese (Traditional)                    Chinese (Traditional)                   
zh-CHS  zh  zho CHS Chinese (Simplified) Legacy              Chinese (Simplified) Legacy             
zh-CHT  zh  zho CHT Chinese (Traditional) Legacy             Chinese (Traditional) Legacy            

*/
Imports System
Imports System.Globalization

Module Module1

   Public Sub Main()

      ' Displays several properties of the neutral cultures.
      Console.WriteLine("CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME")
      Dim ci As CultureInfo
      For Each 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)
      Next ci

   End Sub 'Main 



'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-Hans zh  zho CHS Chinese (Simplified)                     Chinese (Simplified)                    
'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                                 
'zh      zh  zho CHS Chinese                                  Chinese                                 
'zh-Hant zh  zho CHT Chinese (Traditional)                    Chinese (Traditional)                   
'zh-CHS  zh  zho CHS Chinese (Simplified) Legacy              Chinese (Simplified) Legacy             
'zh-CHT  zh  zho CHT Chinese (Traditional) Legacy             Chinese (Traditional) Legacy            

End Module

Commenti

Questi valori di tipo delle impostazioni cultura vengono restituiti per il CultureInfo.CultureTypes proprietà, nonché come un filtro che limita le impostazioni cultura restituite dal CultureInfo.GetCultures (metodo).These culture type values are returned by the CultureInfo.CultureTypes property, and also serve as a filter that limits the cultures returned by the CultureInfo.GetCultures method. Per altre informazioni sulle impostazioni cultura, vedere CultureInfo.For more information on cultures, see CultureInfo.

In genere, si enumerano tutte le impostazioni cultura usando le CultureTypes.AllCultures valore.Generally, you enumerate all cultures by using the CultureTypes.AllCultures value. In questo modo l'enumerazione delle impostazioni cultura personalizzate, nonché altri tipi di impostazioni cultura.This allows enumeration of custom cultures as well as the other culture types.

Si noti che tutti i CultureTypes i membri sono stati deprecati, ad eccezione di CultureTypes.AllCultures, CultureTypes.NeutralCultures, e CultureTypes.SpecificCultures.Note that all CultureTypes members have been deprecated except for CultureTypes.AllCultures, CultureTypes.NeutralCultures, and CultureTypes.SpecificCultures.

.NET riconosce i seguenti tipi di impostazioni cultura, ognuno dei quali sono inclusi nelle enumerazioni restituite dal CultureTypes.AllTypes membro di enumerazione:.NET recognizes the following culture types, all of which are included in enumerations returned by the CultureTypes.AllTypes enumeration member:

  • Le impostazioni cultura specifiche, che specificano un paese/regione e un linguaggio.Specific cultures, which specify a country/region and a language. I nomi di queste impostazioni cultura conformi a RFC 4646.The names of these cultures follow RFC 4646. Il formato è <languagecode2>-<country/regioncode2>, dove <languagecode2> è un codice di due lettere minuscole derivato da ISO 639-1, e <country/regioncode2> è un codice di due lettere maiuscole derivato da ISO 3166.The format is <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. Ad esempio, "en-US" per l'inglese (Stati Uniti) indica impostazioni cultura specifiche.For example, "en-US" for English (United States) is a specific culture. Specifica le impostazioni cultura personalizzate (vale a dire, le impostazioni cultura vengono applicazione - piuttosto che definito dal sistema) possono avere qualsiasi nome specificato dall'utente, non solo uno conforme agli standard.Custom specific cultures (that is, cultures that are application- rather than system-defined) can have any user-specified name, not just a standards-compliant one.

  • Impostazioni cultura non associate, che specifica una lingua senza rispettare un paese/area geografica.Neutral cultures, which specify a language without respect to a country/region. I nomi delle impostazioni cultura non associate sono costituiti dal codice di due lettere minuscole tratto da ISO 639-1.The names of neutral cultures consist of the lowercase two-letter code derived from ISO 639-1. Ad esempio, "en" per l'inglese rappresenta impostazioni cultura non associate ad alcun paese.For example: "en" (English) is a neutral culture. Impostazioni cultura neutre personalizzate (vale a dire, le impostazioni cultura vengono applicazione - piuttosto che definito dal sistema) possono avere qualsiasi nome specificato dall'utente, non solo un codice di due lettere.Custom neutral cultures (that is, cultures that are application- rather than system-defined) can have any user-specified name, not just a two-letter code.

    La lingua inglese è incluso nella matrice di impostazioni cultura restituiti dai CultureInfo.GetCultures metodo che consente di specificare questo valore.The invariant culture is included in the array of cultures returned by the CultureInfo.GetCultures method that specifies this value.

  • Le impostazioni cultura personalizzate, quali sono le impostazioni cultura definite dall'applicazione.Custom cultures, which are application-defined cultures. Le impostazioni cultura personalizzate possono rappresentare le impostazioni cultura specifiche o impostazioni cultura non associate e possono avere qualsiasi nome specificato dall'applicazione.Custom cultures can represent either specific cultures or neutral cultures and can have any application-specified name.

    Nelle versioni di Windows precedenti a Windows 10, il UserCustomCulture valore viene assegnato a impostazioni cultura personalizzate create dallo sviluppatore.In Windows versions prior to Windows 10, the UserCustomCulture value is assigned to custom cultures created by the developer. In Windows 10, il UserCustomCulture valore viene inoltre assegnato alle impostazioni cultura di sistema che non sono supportati da un set completo di dati relative alla lingua e che non dispongono di identificatori univoci locali.In Windows 10, the UserCustomCulture value is also assigned to system cultures that are not backed by a complete set of cultural data and that do not have unique local identifiers. (Tutte le impostazioni cultura di tipo UserCustomCulture condividere un CultureInfo.LCID pari a LOCALE_CUSTOM_UNSPECIFIED (0x1000 o 4096)).(All cultures of type UserCustomCulture share a CultureInfo.LCID value of LOCALE_CUSTOM_UNSPECIFIED (0x1000, or 4096)). Di conseguenza, il CultureInfo.GetCultures(CultureTypes.UserCustomCulture) metodo restituisce diversi set di impostazioni cultura nelle diverse versioni di Windows.As a result, the CultureInfo.GetCultures(CultureTypes.UserCustomCulture) method returns different sets of cultures on different Windows versions.

Si applica a

Vedi anche