Export (0) Print
Expand All

CultureInfo.IsNeutralCulture Property

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
*/


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft