CultureInfo.DisplayName 属性

定义

获取完整的本地化区域性名称。

public:
 virtual property System::String ^ DisplayName { System::String ^ get(); };
public virtual string DisplayName { get; }
member this.DisplayName : string
Public Overridable ReadOnly Property DisplayName As String

属性值

格式为 languagefull [country/regionfull] 的完整本地化区域性名称,其中 languagefull 是语言的全名, country/regionfull 是国家/地区的全名。

示例

下面的代码示例显示非特定区域性的多个属性。

注意

该示例分别显示 zh-CHS 具有0x0004和 zh-CHT 0x7C04区域性标识符的 和 区域性。 但是,Windows Vista 应用程序应使用 zh-Hans 名称而不是 zh-CHSzh-Hant zh-CHT。 zh-Hanszh-Hant 名称表示当前标准,除非有使用旧名称的原因,否则应使用 。

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Displays several properties of the neutral cultures.
   Console::WriteLine( "CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME" );
   System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::NeutralCultures )->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      CultureInfo^ ci = safe_cast<CultureInfo^>(enum0->Current);
      Console::Write( "{0,-7}", ci->Name );
      Console::Write( " {0,-3}", ci->TwoLetterISOLanguageName );
      Console::Write( " {0,-3}", ci->ThreeLetterISOLanguageName );
      Console::Write( " {0,-3}", ci->ThreeLetterWindowsLanguageName );
      Console::Write( " {0,-40}", ci->DisplayName );
      Console::WriteLine( " {0,-40}", ci->EnglishName );
   }
}

/*
This code produces the following output.  This output has been cropped for brevity.

CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME
ar      ar  ara ARA Arabic                                   Arabic                                  
bg      bg  bul BGR Bulgarian                                Bulgarian                               
ca      ca  cat CAT Catalan                                  Catalan                                 
zh-Hans zh  zho CHS Chinese (Simplified)                     Chinese (Simplified)                    
cs      cs  ces CSY Czech                                    Czech                                   
da      da  dan DAN Danish                                   Danish                                  
de      de  deu DEU German                                   German                                  
el      el  ell ELL Greek                                    Greek                                   
en      en  eng ENU English                                  English                                 
es      es  spa ESP Spanish                                  Spanish                                 
fi      fi  fin FIN Finnish                                  Finnish                                 
zh      zh  zho CHS Chinese                                  Chinese                                 
zh-Hant zh  zho CHT Chinese (Traditional)                    Chinese (Traditional)                   
zh-CHS  zh  zho CHS Chinese (Simplified) Legacy              Chinese (Simplified) Legacy             
zh-CHT  zh  zho CHT Chinese (Traditional) Legacy             Chinese (Traditional) Legacy            

*/
using System;
using System.Globalization;

public class SamplesCultureInfo
{

   public static void Main()
   {

      // Displays several properties of the neutral cultures.
      Console.WriteLine("CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME");
      foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
      {
         Console.Write("{0,-7}", ci.Name);
         Console.Write(" {0,-3}", ci.TwoLetterISOLanguageName);
         Console.Write(" {0,-3}", ci.ThreeLetterISOLanguageName);
         Console.Write(" {0,-3}", ci.ThreeLetterWindowsLanguageName);
         Console.Write(" {0,-40}", ci.DisplayName);
         Console.WriteLine(" {0,-40}", ci.EnglishName);
      }
   }
}


/*
This code produces the following output.  This output has been cropped for brevity.

CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME
ar      ar  ara ARA Arabic                                   Arabic
bg      bg  bul BGR Bulgarian                                Bulgarian
ca      ca  cat CAT Catalan                                  Catalan
zh-Hans zh  zho CHS Chinese (Simplified)                     Chinese (Simplified)
cs      cs  ces CSY Czech                                    Czech
da      da  dan DAN Danish                                   Danish
de      de  deu DEU German                                   German
el      el  ell ELL Greek                                    Greek
en      en  eng ENU English                                  English
es      es  spa ESP Spanish                                  Spanish
fi      fi  fin FIN Finnish                                  Finnish
zh      zh  zho CHS Chinese                                  Chinese
zh-Hant zh  zho CHT Chinese (Traditional)                    Chinese (Traditional)
zh-CHS  zh  zho CHS Chinese (Simplified) Legacy              Chinese (Simplified) Legacy
zh-CHT  zh  zho CHT Chinese (Traditional) Legacy             Chinese (Traditional) Legacy

*/
Imports System.Globalization

Module Module1

   Public Sub Main()

      ' Displays several properties of the neutral cultures.
      Console.WriteLine("CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME")
      Dim ci As CultureInfo
      For Each ci In CultureInfo.GetCultures(CultureTypes.NeutralCultures)
         Console.Write("{0,-7}", ci.Name)
         Console.Write(" {0,-3}", ci.TwoLetterISOLanguageName)
         Console.Write(" {0,-3}", ci.ThreeLetterISOLanguageName)
         Console.Write(" {0,-3}", ci.ThreeLetterWindowsLanguageName)
         Console.Write(" {0,-40}", ci.DisplayName)
         Console.WriteLine(" {0,-40}", ci.EnglishName)
      Next ci

   End Sub



'This code produces the following output.  This output has been cropped for brevity.
'
'CULTURE ISO ISO WIN DISPLAYNAME                              ENGLISHNAME
'ar      ar  ara ARA Arabic                                   Arabic                                  
'bg      bg  bul BGR Bulgarian                                Bulgarian                               
'ca      ca  cat CAT Catalan                                  Catalan                                 
'zh-Hans zh  zho CHS Chinese (Simplified)                     Chinese (Simplified)                    
'cs      cs  ces CSY Czech                                    Czech                                   
'da      da  dan DAN Danish                                   Danish                                  
'de      de  deu DEU German                                   German                                  
'el      el  ell ELL Greek                                    Greek                                   
'en      en  eng ENU English                                  English                                 
'es      es  spa ESP Spanish                                  Spanish                                 
'fi      fi  fin FIN Finnish                                  Finnish                                 
'zh      zh  zho CHS Chinese                                  Chinese                                 
'zh-Hant zh  zho CHT Chinese (Traditional)                    Chinese (Traditional)                   
'zh-CHS  zh  zho CHS Chinese (Simplified) Legacy              Chinese (Simplified) Legacy             
'zh-CHT  zh  zho CHT Chinese (Traditional) Legacy             Chinese (Traditional) Legacy            

End Module

注解

此属性表示 对象的本地化名称 CultureInfo

区域性名称可能因脚本或格式约定而异。 应使用返回的名称进行显示,而不是尝试分析它。

如果通过 CultureAndRegionInfoBuilder 类创建自定义区域性,则会将 DisplayName 属性初始化为 属性的值 NativeName

适用于

另请参阅