CultureInfo.Name Property

July 28, 2014

Gets the culture name in the format "languagecode-country/regioncode".

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

Public Overridable ReadOnly Property Name As String

Property Value

Type: System.String
The culture name in the format "languagecode-country/regioncode", where languagecode is a lowercase two-letter code derived from ISO 639-1 and country/regioncode is an uppercase two-letter code derived from ISO 3166.

For a list of predefined culture names and identifiers that the Name property can return, see the National Language Support (NLS) API Reference at the Go Global Developer Center. Note that culture names are subject to change.

The CultureInfo.Name property follows the naming standards provided in the CultureInfo class topic.

The Name property always returns a "short" form of the name that excludes any indication of an alternate sort order. For example, if a CultureInfo object is instantiated for the de-DE_phoneb culture, the Name property returns the string "de-DE".

To get the full name of the culture, you can retrieve the value of the DisplayName, EnglishName, or NativeName property.

The following example displays the Name property as well as the DisplayName and NativeName properties of several cultures.

Imports System.Globalization

Public Module Example
   Public Sub Demo(outputBlock As System.Windows.Controls.TextBlock)
      outputBlock.FontFamily = New FontFamily("Courier New")

      Dim cultureStrings() As String = {"nl-NL", "en", "en-US", "fr-FR", _
                                        "de-DE", "ru-RU", "sr-Cyrl-CS", _ 
                                        "sr-Latn-CS", "es-MX", "sv-SE"}
      outputBlock.Text += String.Format("{0,-15} {1,-15} {2,-30} {3,-30}", _
                                        "Culture", "Name", "DisplayName", _
                                        "NativeName") + vbCrLf + vbCrLf
      For Each cultureString As String In cultureStrings
            Dim ci As New CultureInfo(cultureString)
            outputBlock.Text += String.Format("{0,-15} {1,-15} {2,-30} {3,-30}", _
                                              cultureString + ":", ci.Name, _
                                              ci.DisplayName, ci.NativeName) + vbCrLf
         Catch e As ArgumentException
            outputBlock.Text += String.Format("Unable to create the {0} culture.", _
                                              cultureString) + vbCrLf
         End Try
   End Sub
End Module
' The example displays the following output:
' Culture         Name            DisplayName                    NativeName                    
' nl-NL:          nl-NL           Dutch (Netherlands)            Nederlands (Nederland)        
' en:             en              English                        English                       
' en-US:          en-US           English (United States)        English (United States)       
' fr-FR:          fr-FR           French (France)                français (France)             
' de-DE:          de-DE           German (Germany)               Deutsch (Deutschland)         
' ru-RU:          ru-RU           Russian (Russia)               русский (Россия)              
' sr-Cyrl-CS:     sr-Cyrl-CS      Serbian (Cyrillic, Serbia)     српски (Србија)               
' sr-Latn-CS:     sr-Latn-CS      Serbian (Latin, Serbia)        srpski (Srbija)               
' es-MX:          es-MX           Spanish (Mexico)               Español (México)              
' sv-SE:          sv-SE           Swedish (Sweden)               svenska (Sverige)             

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2014 Microsoft