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)

Syntax

Public Overridable ReadOnly Property IsNeutralCulture As Boolean
public virtual bool IsNeutralCulture { get; }

Property Value

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

Remarks

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

Examples

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

Imports System.Globalization

Public Class Example

   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      outputBlock.FontFamily = New System.Windows.Media.FontFamily("Courier New")

      ' Create an array of Chinese culture names.
      Dim cultureNames() As String = { "zh-CN", "zh-Hans", "zh-Hant", "zh-HK", _  
                                       "zh-MO", "zh-SG", "zh-TW" }

      ' Determine if each culture is a neutral culture.
      For Each cultureName As String In cultureNames
         Dim ci As New CultureInfo(cultureName)
         outputBlock.Text += String.Format("{0,-7} {1,-40}", ci.Name, ci.EnglishName)
         If ci.IsNeutralCulture Then
            outputBlock.Text &= ": neutral" & vbCrLf
         Else
            outputBlock.Text &= ": specific" & vbCrLf
         End If
      Next
   End Sub
End Class
'  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
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
*/

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

CultureInfo Class

System.Globalization Namespace

InvariantCulture