CultureInfo.Name Property
Assembly: mscorlib (in mscorlib.dll)
/** @property */ public String get_Name ()
public function get Name () : String
Property Value
The culture name in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166.The CultureInfo.Name property follows the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>", where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. For example, the Name for the specific culture U.S. English is "en-US". In cases where a two-letter language code is not available, the three-letter code derived from ISO 639-2 is used; for example, the three-letter code "div" is used for cultures that use the Dhivehi language.
If the culture is a neutral culture, its Name is in the format "<languagecode2>". For example, the Name for the neutral culture English is "en".
The predefined CultureInfo names are listed in the CultureInfo class topic.
To get the full name of the culture, use DisplayName, EnglishName, or NativeName.
The following code example displays several properties of the neutral cultures.
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-CHS zh zho CHS Chinese (Simplified) Chinese (Simplified) zh-CHT zh zho CHT Chinese (Traditional) Chinese (Traditional) 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 */
import System.* ;
import System.Globalization.* ;
public class SamplesCultureInfo
{
public static void main(String[] args)
{
// Displays several properties of the neutral cultures.
Console.WriteLine("CULTURE ISO ISO WIN DISPLAYNAME "
+ " ENGLISHNAME");
for (int iCtr = 0;
iCtr < (CultureInfo.GetCultures(CultureTypes.NeutralCultures).
length); iCtr++) {
CultureInfo ci =
CultureInfo.GetCultures(CultureTypes.NeutralCultures)[iCtr];
Console.Write("{0,-7}", ci.get_Name());
Console.Write(" {0,-3}", ci.get_TwoLetterISOLanguageName());
Console.Write(" {0,-3}", ci.get_ThreeLetterISOLanguageName());
Console.Write(" {0,-3}", ci.get_ThreeLetterWindowsLanguageName());
Console.Write(" {0,-40}", ci.get_DisplayName());
Console.WriteLine(" {0,-40}", ci.get_EnglishName());
}
} //main
} //SamplesCultureInfo
/*
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-CHS zh zho CHS Chinese (Simplified) Chinese
(Simplified)
zh-CHT zh zho CHT Chinese (Traditional) Chinese
(Traditional)
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
*/
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.