Gets the CultureInfo that represents the parent culture of the current CultureInfo.
[Visual Basic]
Public Overridable ReadOnly Property Parent As CultureInfo
[C#]
public virtual CultureInfo Parent {get;}
[C++]
public: __property virtual CultureInfo* get_Parent();
[JScript]
public function get Parent() : CultureInfo; Property Value
The CultureInfo that represents the parent culture of the current CultureInfo.
Remarks
The cultures have a hierarchy, such that the parent of a specific culture is a neutral culture and the parent of a neutral culture is the InvariantCulture. 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 Resource Fallback Process.
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 .NET Framework. This will ensure consistency with the equivalent Windows locale, which is identified with the same LCID.
Example
[Visual Basic, C#, C++] The following code example determines the parent culture of each specific culture using the Chinese language.
[Visual Basic]
Imports System
Imports System.Globalization
Public Class SamplesCultureInfo
Public Shared Sub Main()
' Prints the header.
Console.WriteLine("SPECIFIC CULTURE PARENT CULTURE")
' Determines the specific cultures that use the Chinese language, and displays the parent culture.
Dim ci As CultureInfo
For Each ci In CultureInfo.GetCultures(CultureTypes.SpecificCultures)
If ci.TwoLetterISOLanguageName = "zh" Then
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)
End If
Next ci
End Sub 'Main
End Class '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)
[C#]
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.) 0x0004 zh-CHS Chinese (Simplified)
*/
[C++]
#using <mscorlib.dll>
using namespace System;
using namespace System::Globalization;
int main() {
// Prints the header.
Console::WriteLine(S"SPECIFIC CULTURE PARENT CULTURE" );
// Determines the specific cultures that use the Chinese language,
// and displays the parent culture.
System::Collections::IEnumerator* en =
CultureInfo::GetCultures(CultureTypes::SpecificCultures)->GetEnumerator();
while (en->MoveNext())
{
CultureInfo* ci = __try_cast<CultureInfo*>(en->Current);
if (ci->TwoLetterISOLanguageName->Equals(S"zh"))
{
Console::Write(S"0x{0} {1} {2,-37}", ci->LCID.ToString("X4"),
ci->Name, ci->EnglishName);
Console::WriteLine(S"0x{0} {1} {2}", ci->Parent->LCID.ToString(S"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.) 0x0004 zh-CHS Chinese (Simplified)
*/
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
CultureInfo Class | CultureInfo Members | System.Globalization Namespace | CultureInfo | CreateSpecificCulture | CurrentCulture | CurrentUICulture | InstalledUICulture | InvariantCulture