CultureInfo.IsNeutralCulture プロパティ

定義

現在の CultureInfo がニュートラル カルチャを表しているかどうかを示す値を取得します。

public:
 virtual property bool IsNeutralCulture { bool get(); };
public virtual bool IsNeutralCulture { get; }
member this.IsNeutralCulture : bool
Public Overridable ReadOnly Property IsNeutralCulture As Boolean

プロパティ値

Boolean

現在の CultureInfo がニュートラル カルチャを表している場合は true。それ以外の場合は false

次のコード例では、中立カルチャである中国語を使用するカルチャを決定します。

注意

この例では、古いカルチャ名とカルチャ名を、それぞれ 0x0004と0x7C04 zh-CHS zh-CHT 識別子と一緒に表示します。 ただし、Windows Vista アプリケーションでは、 の代わりに 名前を使用し zh-Hans zh-CHS zh-Hant 、zh- ISTA ではなく名前を使用する必要があります。 と の名前は現在の標準を表し、古い名前を使用する理由がない限り zh-Hans zh-Hant 使用する必要があります。

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Lists the cultures that use the Chinese language and determines if each is a neutral culture.
   System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::AllCultures )->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      CultureInfo^ ci = safe_cast<CultureInfo^>(enum0->Current);
      if ( ci->TwoLetterISOLanguageName->Equals( "zh" ) )
      {
         Console::Write( "{0,-7} {1,-40}", ci->Name, ci->EnglishName );
         if ( ci->IsNeutralCulture )
         {
            Console::WriteLine( ": neutral" );
         }
         else
         {
            Console::WriteLine( ": specific" );
         }
      }
   }
}

/*
This code produces the following output.

zh-Hans Chinese (Simplified)                    : neutral
zh-TW   Chinese (Traditional, Taiwan)           : specific
zh-CN   Chinese (Simplified, PRC)               : specific
zh-HK   Chinese (Traditional, Hong Kong S.A.R.) : specific
zh-SG   Chinese (Simplified, Singapore)         : specific
zh-MO   Chinese (Traditional, Macao S.A.R.)     : specific
zh      Chinese                                 : neutral
zh-Hant Chinese (Traditional)                   : neutral
zh-CHS  Chinese (Simplified) Legacy             : neutral
zh-CHT  Chinese (Traditional) Legacy            : neutral

*/
using System;
using System.Globalization;

public class SamplesCultureInfo
{

   public static void Main()
   {

      // Lists the cultures that use the Chinese language and determines if each is a neutral culture.
      foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures))
      {
         if (ci.TwoLetterISOLanguageName == "zh")
         {
            Console.Write("{0,-7} {1,-40}", ci.Name, ci.EnglishName);
            if (ci.IsNeutralCulture)
            {
               Console.WriteLine(": neutral");
                }
            else
            {
               Console.WriteLine(": specific");
            }
         }
      }
   }
}


/*
This code produces the following output.

zh-Hans Chinese (Simplified)                    : neutral
zh-TW   Chinese (Traditional, Taiwan)           : specific
zh-CN   Chinese (Simplified, PRC)               : specific
zh-HK   Chinese (Traditional, Hong Kong S.A.R.) : specific
zh-SG   Chinese (Simplified, Singapore)         : specific
zh-MO   Chinese (Traditional, Macao S.A.R.)     : specific
zh      Chinese                                 : neutral
zh-Hant Chinese (Traditional)                   : neutral
zh-CHS  Chinese (Simplified) Legacy             : neutral
zh-CHT  Chinese (Traditional) Legacy            : neutral

*/
Imports System.Globalization

Module Module1

   Public Sub Main()

      ' Lists the cultures that use the Chinese language and determines if each is a neutral culture.
      Dim ci As CultureInfo
      For Each ci In CultureInfo.GetCultures(CultureTypes.AllCultures)
         If ci.TwoLetterISOLanguageName = "zh" Then
            Console.Write("{0,-7} {1,-40}", ci.Name, ci.EnglishName)
            If ci.IsNeutralCulture Then
               Console.WriteLine(": neutral")
            Else
               Console.WriteLine(": specific")
            End If
         End If
      Next ci

   End Sub

End Module


'This code produces the following output.
'
'zh-Hans Chinese (Simplified)                    : neutral
'zh-TW   Chinese (Traditional, Taiwan)           : specific
'zh-CN   Chinese (Simplified, PRC)               : specific
'zh-HK   Chinese (Traditional, Hong Kong S.A.R.) : specific
'zh-SG   Chinese (Simplified, Singapore)         : specific
'zh-MO   Chinese (Traditional, Macao S.A.R.)     : specific
'zh      Chinese                                 : neutral
'zh-Hant Chinese (Traditional)                   : neutral
'zh-CHS  Chinese (Simplified) Legacy             : neutral
'zh-CHT  Chinese (Traditional) Legacy            : neutral

注釈

ニュートラル カルチャは、言語に関連付けられているが、国や地域には関連付けされないカルチャです。 特定のカルチャとは異なります。これは、言語と国または地域の両方に関連付けられているカルチャです。 たとえば、fr は中立フランス語カルチャの名前、fr-FR はフランス語のフランス語カルチャの名前です。

このプロパティが を返 false す場合、カルチャは特定のカルチャまたはインバリアント カルチャのいずれかです。

適用対象

こちらもご覧ください