CultureInfo.Parent Property

May 11, 2014

Gets the CultureInfo that represents the parent culture of the current CultureInfo.

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

public virtual CultureInfo Parent { get; }

Property Value

Type: System.Globalization.CultureInfo
The CultureInfo that represents the parent culture of the current CultureInfo.

The cultures have a hierarchy in which the parent of a specific culture is a neutral culture, the parent of a neutral culture is the InvariantCulture, and the parent of the InvariantCulture is the invariant culture itself. The parent culture encompasses only the set of information that is common among its children.

The following example determines the parent culture of each specific culture that uses the Chinese language.


using System;
using System.Globalization;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      // Displays the header.
      outputBlock.FontFamily = new System.Windows.Media.FontFamily("Courier New");
      outputBlock.Text += "SPECIFIC CULTURE                             PARENT CULTURE" + "\n";

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

      // Determines the specific cultures that use the Chinese language, and displays the parent culture.
      foreach (string cultureName in cultureNames)
      {
         CultureInfo ci = new CultureInfo(cultureName);
         outputBlock.Text += String.Format("{0,-7} {1,-37}", ci.Name, ci.EnglishName);
         outputBlock.Text += String.Format("{0,-7} {1}\n", ci.Parent.Name, ci.Parent.EnglishName);
      }
   }
}
/*
This example produces the following output.

SPECIFIC CULTURE                             PARENT CULTURE
zh-CN   Chinese (People's Republic of China) zh-Hans Chinese 
zh-Hans Chinese                                      Invariant Language (Invariant Country)
zh-Hant Chinese                                      Invariant Language (Invariant Country)
zh-HK   Chinese (Hong Kong S.A.R.)           zh-Hant Chinese 
zh-MO   Chinese (Macao S.A.R.)               zh-Hant Chinese 
zh-SG   Chinese (Singapore)                  zh-Hans Chinese 
zh-TW   Chinese (Taiwan)                     zh-Hant Chinese 
*/


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft