Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

CultureInfo.Name Property

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

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)
public virtual string Name { get; }

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.


using System;
using System.Globalization;
using System.Windows.Media;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      outputBlock.FontFamily = new FontFamily("Courier New");

      string[] cultureStrings= {"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}\n\n", 
                                        "Culture", "Name", "DisplayName", 
                                        "NativeName"); 
      foreach (string cultureString in cultureStrings)
      {
         try {
            CultureInfo ci = new CultureInfo(cultureString);
            outputBlock.Text += String.Format("{0,-15} {1,-15} {2,-30} {3,-30}\n", 
                                              cultureString + ":", ci.Name, 
                                              ci.DisplayName, ci.NativeName);
         }
         catch (ArgumentException) {
            outputBlock.Text += String.Format("Unable to create the {0} culture.\n", cultureString);
         }
      }                                        
   }
}
// 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)             


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

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.