CultureInfo.Parent 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
得到 CultureInfo 代表當前 CultureInfo母文化的 。
public:
virtual property System::Globalization::CultureInfo ^ Parent { System::Globalization::CultureInfo ^ get(); };
public virtual System.Globalization.CultureInfo Parent { get; }
member this.Parent : System.Globalization.CultureInfo
Public Overridable ReadOnly Property Parent As CultureInfo
屬性值
該 CultureInfo 代表當前 CultureInfo的母文化。
範例
以下程式碼範例決定每個特定文化的母體文化,使用中文。
Note
範例中分別顯示較舊 zh-CHS 的名稱與 zh-CHT 文化名稱,並附0x0004與0x7C04文化識別碼。 不過,你的 Windows Vista 應用程式應該用 zh-Hans the name 代替 zh-CHS ,且 the zh-Hant name 代替 zh-CHT。
zh-Hans and zh-Hant 名稱代表現行標準,除非你有使用舊名稱的理由,否則應該使用。
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,-40}", 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 (Traditional, Taiwan) 0x7C04 zh-CHT Chinese (Traditional) Legacy
0x0804 zh-CN Chinese (Simplified, PRC) 0x0004 zh-CHS Chinese (Simplified) Legacy
0x0C04 zh-HK Chinese (Traditional, Hong Kong S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy
0x1004 zh-SG Chinese (Simplified, Singapore) 0x0004 zh-CHS Chinese (Simplified) Legacy
0x1404 zh-MO Chinese (Traditional, Macao S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy
*/
Imports System.Globalization
Module Module1
Public 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,-40}", 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
'This code produces the following output.
'
'SPECIFIC CULTURE PARENT CULTURE
'0x0404 zh-TW Chinese (Traditional, Taiwan) 0x7C04 zh-CHT Chinese (Traditional) Legacy
'0x0804 zh-CN Chinese (Simplified, PRC) 0x0004 zh-CHS Chinese (Simplified) Legacy
'0x0C04 zh-HK Chinese (Traditional, Hong Kong S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy
'0x1004 zh-SG Chinese (Simplified, Singapore) 0x0004 zh-CHS Chinese (Simplified) Legacy
'0x1404 zh-MO Chinese (Traditional, Macao S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy
End Module
備註
這些文化有階層結構,其中特定文化的父體是中立文化,中立文化的父體是 InvariantCulture,而 的 InvariantCulture 父體是不變文化本身。 母文化僅涵蓋其子女之間共同的資訊集合。
如果系統中沒有特定文化的資源,則會使用中立文化的資源。 如果中性文化特性的資源無法使用,則會使用內嵌在主要元件中的資源。 如需資源後援程序的詳細資訊,請參閱 封裝和部署資源。