CultureInfo.GetCultures(CultureTypes) CultureInfo.GetCultures(CultureTypes) CultureInfo.GetCultures(CultureTypes) CultureInfo.GetCultures(CultureTypes) Method

정의

지정된 CultureTypes 매개 변수에 의해 필터링된 지원 문화권 목록을 가져옵니다.Gets the list of supported cultures filtered by the specified CultureTypes parameter.

public:
 static cli::array <System::Globalization::CultureInfo ^> ^ GetCultures(System::Globalization::CultureTypes types);
public static System.Globalization.CultureInfo[] GetCultures (System.Globalization.CultureTypes types);
static member GetCultures : System.Globalization.CultureTypes -> System.Globalization.CultureInfo[]
Public Shared Function GetCultures (types As CultureTypes) As CultureInfo()

매개 변수

types
CultureTypes CultureTypes CultureTypes CultureTypes

검색할 문화권을 필터링하는 열거형 값의 비트 조합입니다.A bitwise combination of the enumeration values that filter the cultures to retrieve.

반환

types 매개 변수로 지정된 문화권이 포함된 배열입니다.An array that contains the cultures specified by the types parameter. 문화권의 배열은 정렬되어 있지 않습니다.The array of cultures is unsorted.

예외

types가 잘못된 CultureTypes 값 조합을 지정하는 경우types specifies an invalid combination of CultureTypes values.

예제

다음 코드 예제는 중립 문화권의 여러 속성을 표시합니다.The following code example displays several properties of the neutral cultures.

참고

이 예제에서는 각각 0x0004와 0x7C04 문화권 식별자를 사용 하 여 ZH-CHS 및 ZH-CHT 문화권을 표시합니다.The example displays the zh-CHS and zh-CHT cultures with the 0x0004 and 0x7C04 culture identifiers, respectively. 그러나 Windows Vista 응용 프로그램 대신 ZH-CHT 대신 Zh-hant 이름과 ZH-CHS Zh-hans 이름을 사용 해야 합니다.However, your Windows Vista applications should use the zh-Hans name instead of zh-CHS and the zh-Hant name instead of zh-CHT. Zh-hans 및 Zh-hant 이름을 현재 표준 나타내고 이전 이름을 사용 하는 것에 대 한 이유가 없다면 사용 해야 합니다.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.

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

설명

GetCultures 메서드를 자주 호출 된 types 매개 변수는 다음 값으로 설정:The GetCultures method is most commonly called with the types parameter set to the following values:

  • SpecificCultures를 반환 하는 모든 특정 문화권입니다.SpecificCultures, which returns all specific cultures.

  • NeutralCultures에 모든 중립 문화권 및 고정 문화권을 반환 합니다.NeutralCultures, which returns all neutral cultures and the invariant culture.

  • AllCultures에서 모든 중립 및 특정 문화권, Windows 시스템에 설치 된 문화권 및 사용자가 만든 사용자 지정 culture를 반환 하는 합니다.AllCultures, which returns all neutral and specific cultures, cultures installed in the Windows system, and custom cultures created by the user.

  • UserCustomCulture를에서 등록 된 것과 같은 모든 사용자 지정 culture를 반환 하는 CultureAndRegionInfoBuilder 클래스입니다.UserCustomCulture, which returns all custom cultures, such as those registered by the CultureAndRegionInfoBuilder class. Windows 10 이전의 Windows 버전에는 UserCustomCulture 값 모든 사용자 정의 사용자 지정 문화권에 적용 됩니다.In versions of Windows before Windows 10, the UserCustomCulture value applies to all user-defined custom cultures. Windows 10 부터는 적용할 전체 문화권 데이터가 부족 하 고 고유한 로컬 식별자를 없는 시스템 문화권에 표시 된 대로 LCID 속성 값입니다.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. 결과적으로 다음과 같은 코드는 이전 버전의 Windows 및 Windows 10에서 실행 될 때는 다른 결과 반환 합니다.As a result, code such as the following will return different results when run on Windows 10 and on an earlier version of Windows.

    using System;
    using System.Globalization;
    
    public class Example
    {
       public static void Main()
       {
           CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.UserCustomCulture |
                                                            CultureTypes.SpecificCultures);
          int ctr = 0;
          foreach (var culture in cultures)
             if ((culture.CultureTypes & CultureTypes.UserCustomCulture) == CultureTypes.UserCustomCulture)
                ctr++;
    
          Console.WriteLine("Number of Specific Custom Cultures: {0}", ctr);
       }
    }
    // If run under Windows 8, the example displays output like the following:
    //      Number of Specific Custom Cultures: 6
    // If run under Windows 10, the example displays output like the following:
    //      Number of Specific Custom Cultures: 279
    
    Imports System.Globalization
    
    Module Example
       Sub Main()
           Dim cultures() As CultureInfo = CultureInfo.GetCultures(CultureTypes.UserCustomCulture Or
                                                                   CultureTypes.SpecificCultures)
          Dim ctr As Integer = 0
          For Each culture In cultures
             If (culture.CultureTypes And CultureTypes.UserCustomCulture) = CultureTypes.UserCustomCulture Then
                ctr += 1
             End If
          Next
          Console.WriteLine("Number of Specific Custom Cultures: {0}", ctr)
       End Sub
    End Module
    ' If run under Windows 8, the example displays output like the following:
    '      Number of Specific Custom Cultures: 6
    ' If run under Windows 10, the example displays output like the following:
    '      Number of Specific Custom Cultures: 279
    

적용 대상

추가 정보