IsNeutralCulture Property

CultureInfo.IsNeutralCulture Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets a value indicating whether the current CultureInfo object represents a neutral culture.

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

public virtual bool IsNeutralCulture { get; }

Property Value

Type: System.Boolean
true if the current CultureInfo object represents a neutral culture; otherwise, false.

If this property returns false, the culture is either a specific culture or the invariant culture.

The following example determines which cultures using the Chinese language are neutral cultures.


using System;
using System.Globalization;

public class Example
{

   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      outputBlock.FontFamily = new System.Windows.Media.FontFamily("Courier New");

      // Create an array of Chinese culture names.
      string[] cultureNames = { "zh-CN", "zh-Hans", "zh-Hant", "zh-HK",  
                                "zh-MO", "zh-SG", "zh-TW" };

      // Determine if each culture is a neutral culture.
      foreach (string cultureName in cultureNames)
      {
         CultureInfo ci = new CultureInfo(cultureName);

         outputBlock.Text += String.Format("{0,-7} {1,-40}", ci.Name, ci.EnglishName);
         if (ci.IsNeutralCulture)
               outputBlock.Text += ": neutral" + "\n";
         else
               outputBlock.Text += ": specific" + "\n";
      }

   }

}
/*
This example produces the following output.
   zh-CN   Chinese (People's Republic of China)    : specific
   zh-Hans Chinese                                 : neutral
   zh-Hant Chinese                                 : neutral
   zh-HK   Chinese (Hong Kong S.A.R.)              : specific
   zh-MO  Chinese (Macao S.A.R.)                   : specific
   zh-SG  Chinese (Singapore)                      : specific
   zh-TW  Chinese (Taiwan)                         : specific
*/


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft