Udostępnij za pośrednictwem


CultureInfo.DisplayName Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the culture name in the format "language (country/region)" in the language of the localized version of .NET Framework.

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

Syntax

'Declaration
Public Overridable ReadOnly Property DisplayName As String
public virtual string DisplayName { get; }

Property Value

Type: System.String
The culture name in the format "language (country/region)" in the language of the localized version of .NET Framework, where language is the full name of the language and country/region is the full name of the country or region.

Remarks

For example, if the .NET Framework English version is installed, the DisplayName property for the "en-US" culture returns "English (United States)". If the .NET Framework Spanish version is installed, regardless of the language that the system is set to display, the culture name is displayed in Spanish. Therefore, the DisplayName property for the "en-US" culture returns "Ingles (Estados Unidos)".

Examples

The following example displays the value of the DisplayName property of a number of cultures.

Imports System.Globalization

Module Example
   Public Sub Demo(outputBlock As System.Windows.Controls.TextBlock)

      Dim cultureNames() As String = { "en-US", "es-US", "fr-FR", "sr-Cyrl-CS", _
                                     "sr-Latn-CS", "zh-Hans", "zh-Hant"}

      For Each cultureName As String In cultureNames
         Dim culture As New CultureInfo(cultureName)
         outputBlock.Text &= culture.DisplayName & vbCrLf
      Next
   End Sub
End Module
' The example displays the following output if run on an English version 
' of the .NET Framework:
'       English (United States)
'       Spanish (United States)
'       French (France)
'       Serbian (Cyrillic, Serbia)
'       Serbian (Latin, Serbia)
'       Chinese (PRC)
'       Chinese (Taiwan)
using System;
using System.Globalization;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      string[] cultureNames = { "en-US", "es-US", "fr-FR", "sr-Cyrl-CS", 
                                "sr-Latn-CS", "zh-Hans", "zh-Hant"};

      foreach (string cultureName in cultureNames)
      {
         CultureInfo culture = new CultureInfo(cultureName);
         outputBlock.Text += culture.DisplayName + "\n";
      }
   }
}
// The example displays the following output if run on an English version 
// of the .NET Framework:
//       English (United States)
//       Spanish (United States)
//       French (France)
//       Serbian (Cyrillic, Serbia)
//       Serbian (Latin, Serbia)
//       Chinese (PRC)
//       Chinese (Taiwan)

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.