Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Parent Property

CultureInfo.Parent Property

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 */
public CultureInfo get_Parent ()

public function get Parent () : CultureInfo

Property Value

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

The cultures have a hierarchy, such that 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.

If the resources for the specific culture are not available in the system, the resources for the neutral culture are used; if the resources for the neutral culture are not available, the resources embedded in the main assembly are used. For more information on the resource fallback process, see Packaging and Deploying Resources.

The list of cultures in the Windows API is slightly different from the list of cultures in the .NET Framework. For example, the neutral culture zh-CHT "Chinese (Traditional)" with culture identifier 0x7C04 is not available in the Windows API. If interoperability with Windows is required (for example, through the p/invoke mechanism), use a specific culture that is defined in the operating system. This will ensure consistency with the equivalent Windows locale, which is identified with the same LCID.

The following code example determines the parent culture of each specific culture using the Chinese language.

using System;
using System.Globalization;

public class SamplesCultureInfo  {

   public static void Main()  {

      // Prints the header.
      Console.WriteLine( "SPECIFIC CULTURE                                  PARENT CULTURE" );

      // Determines the specific cultures that use the Chinese language, and displays the parent culture.
      foreach ( CultureInfo ci in CultureInfo.GetCultures( CultureTypes.SpecificCultures ) )  {
         if ( ci.TwoLetterISOLanguageName == "zh" )  {
            Console.Write( "0x{0} {1} {2,-37}", ci.LCID.ToString("X4"), ci.Name, ci.EnglishName );
            Console.WriteLine( "0x{0} {1} {2}", ci.Parent.LCID.ToString("X4"), ci.Parent.Name, ci.Parent.EnglishName );
         }
      }

   }

}

/*
This code produces the following output.

SPECIFIC CULTURE                                  PARENT CULTURE
0x0404 zh-TW Chinese (Taiwan)                     0x7C04 zh-CHT Chinese (Traditional)
0x0804 zh-CN Chinese (People's Republic of China) 0x0004 zh-CHS Chinese (Simplified)
0x0C04 zh-HK Chinese (Hong Kong S.A.R.)           0x7C04 zh-CHT Chinese (Traditional)
0x1004 zh-SG Chinese (Singapore)                  0x0004 zh-CHS Chinese (Simplified)
0x1404 zh-MO Chinese (Macau S.A.R.)               0x7C04 zh-CHT Chinese (Traditional)

*/

import System.* ;
import System.Globalization.* ;

public class SamplesCultureInfo
{
    public static void main(String[] args)
    {
        // Prints the header.
        Console.WriteLine("SPECIFIC CULTURE                                " 
            + "  PARENT CULTURE");

        // Determines the specific cultures that use the Chinese language, 
        // and displays the parent culture.
        for(int iCtr=0;
            iCtr < (CultureInfo.GetCultures(CultureTypes.SpecificCultures).
                length); iCtr++) {
            CultureInfo ci = 
                CultureInfo.GetCultures(CultureTypes.SpecificCultures)[iCtr];
            if (ci.get_TwoLetterISOLanguageName().equalsIgnoreCase("zh")) {
                Console.Write("0x{0} {1} {2,-37}", 
                    ((System.Int32 ) ci.get_LCID()).ToString("X4") , 
                    ci.get_Name(), ci.get_EnglishName());
                Console.WriteLine("0x{0} {1} {2}", 
                    ((System.Int32 )ci.get_Parent().get_LCID()).ToString("X4"),
                    ci.get_Parent().get_Name(), 
                    ci.get_Parent().get_EnglishName());
            }
        }
    } //main
} //SamplesCultureInfo

/*
This code produces the following output.

SPECIFIC CULTURE                                  PARENT CULTURE
0x0404 zh-TW Chinese (Taiwan)                     0x7C04 zh-CHT Chinese 
(Traditional)
0x0804 zh-CN Chinese (People's Republic of China) 0x0004 zh-CHS Chinese 
(Simplified)
0x0C04 zh-HK Chinese (Hong Kong S.A.R.)           0x7C04 zh-CHT Chinese 
(Traditional)
0x1004 zh-SG Chinese (Singapore)                  0x0004 zh-CHS Chinese 
(Simplified)
0x1404 zh-MO Chinese (Macau S.A.R.)               0x0004 zh-CHS Chinese 
(Simplified)
*/

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2015 Microsoft