CultureInfo.Name Property

Definition

Gets the culture name in the format languagecode2-country/regioncode2.

C#
public virtual string Name { get; }

Property Value

The culture name in the format languagecode2-country/regioncode2, if the current CultureInfo is culture-dependent; or an empty string, if it's an invariant culture. languagecode2 is a lowercase two-letter code as defined in ISO 639-1, or, if no two-letter code is available, a three-letter code as defined in ISO 639-3. country/regioncode2 contains a value defined in ISO 3166 and usually consists of two uppercase letters, or a BCP-47 language tag.

Examples

The following code example displays several properties of the neutral cultures.

Note

The example displays the older zh-CHS and zh-CHT culture names with the 0x0004 and 0x7C04 culture identifiers, respectively. However, your Windows Vista applications should use the zh-Hans name instead of zh-CHS and the zh-Hant name instead of zh-CHT. The zh-Hans and zh-Hant names represent the current standard, and should be used unless you have a reason for using the older names.

C#
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

*/

Remarks

For a list of predefined culture names and identifiers that the Name property can return on Windows systems, see the Language tag column in the list of language/region names supported by Windows. Culture names follow the standard defined by BCP 47. In addition, starting with Windows 10, name can be any valid BCP-47 language tag. Note that culture names are subject to change, and that they also can reflect the names of custom cultures.

The CultureInfo.Name property follows the naming standards provided in the CultureInfo class topic. It returns the short form of the culture name that excludes any indication of an alternate sort order. For example, if you instantiate a CultureInfo object by using the string "de-DE_phoneb" to reflect an alternate sort order, the Name property returns "de-DE".

To get the full name of the culture, you should use the DisplayName, EnglishName, or NativeName property.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

See also