Creates a CultureInfo that represents the specific culture that is associated with the specified name.
Namespace:
System.Globalization
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
Public Shared Function CreateSpecificCulture ( _
name As String _
) As CultureInfo
Dim name As String
Dim returnValue As CultureInfo
returnValue = CultureInfo.CreateSpecificCulture(name)
public static CultureInfo CreateSpecificCulture(
string name
)
public:
static CultureInfo^ CreateSpecificCulture(
String^ name
)
public static function CreateSpecificCulture(
name : String
) : CultureInfo
Return Value
Type:
System.Globalization..::.CultureInfoA CultureInfo object that represents:
The invariant culture, if name is an empty string ("").
-or-
The specific culture associated with name, if name is a neutral culture.
-or-
The culture specified by name, if name is already a specific culture.
The cultures are generally grouped into three sets: the invariant culture, the neutral cultures, and the specific cultures. For more information, see the description of the CultureInfo class.
If the culture identifier associated with the specified culture name matches the culture identifier of the current Windows culture, this method creates a CultureInfo object that uses the Windows culture overrides. The overrides include user settings for the properties of the DateTimeFormatInfo object returned by the DateTimeFormat property, and the properties of the NumberFormatInfo object returned by the NumberFormat property.
The following code example shows the results of CreateSpecificCulture with different culture types.
Note: |
|---|
The example displays the zh-CHS and zh-CHT cultures 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. |
Imports System
Imports System.Globalization
Public Class SamplesCultureInfo
Public Shared Sub Main()
' Prints the header.
Console.WriteLine("CULTURE SPECIFIC CULTURE")
' Determines the specific culture associated with each culture in the .NET Framework.
Dim ci As CultureInfo
For Each ci In CultureInfo.GetCultures(CultureTypes.AllCultures)
Console.Write("{0,-12} {1,-40}", ci.Name, ci.EnglishName)
Try
Console.WriteLine("{0}", CultureInfo.CreateSpecificCulture(ci.Name).Name)
Catch e As ArgumentException
Console.WriteLine("(no associated specific culture)")
End Try
Next ci
End Sub 'Main
End Class 'SamplesCultureInfo
'This code produces the following output. This output has been cropped for brevity.
'
'CULTURE SPECIFIC CULTURE
'ar Arabic ar-SA
'bg Bulgarian bg-BG
'ca Catalan ca-ES
'zh-CHS Chinese (Simplified) (no associated specific culture)
'cs Czech cs-CZ
'da Danish da-DK
'de German de-DE
'el Greek el-GR
'en English en-US
'es Spanish es-ES
'fi Finnish fi-FI
'fr French fr-FR
'he Hebrew he-IL
'hu Hungarian hu-HU
'is Icelandic is-IS
'it Italian it-IT
'ja Japanese ja-JP
'ko Korean ko-KR
'nl Dutch nl-NL
'no Norwegian nb-NO
'pl Polish pl-PL
'pt Portuguese pt-BR
'ro Romanian ro-RO
'ru Russian ru-RU
'hr Croatian hr-HR
'sk Slovak sk-SK
'sq Albanian sq-AL
'sv Swedish sv-SE
'th Thai th-TH
'tr Turkish tr-TR
'ur Urdu ur-PK
'id Indonesian id-ID
'uk Ukrainian uk-UA
'be Belarusian be-BY
'sl Slovenian sl-SI
'et Estonian et-EE
'lv Latvian lv-LV
'lt Lithuanian lt-LT
'fa Persian fa-IR
'vi Vietnamese vi-VN
'hy Armenian hy-AM
'az Azeri az-Latn-AZ
using System;
using System.Globalization;
public class SamplesCultureInfo {
public static void Main() {
// Prints the header.
Console.WriteLine( "CULTURE SPECIFIC CULTURE" );
// Determines the specific culture associated with each culture in the .NET Framework.
foreach ( CultureInfo ci in CultureInfo.GetCultures( CultureTypes.AllCultures ) ) {
Console.Write( "{0,-12} {1,-40}", ci.Name, ci.EnglishName );
try {
Console.WriteLine( "{0}", CultureInfo.CreateSpecificCulture( ci.Name ).Name );
}
catch {
Console.WriteLine( "(no associated specific culture)" );
}
}
}
}
/*
This code produces the following output. This output has been cropped for brevity.
CULTURE SPECIFIC CULTURE
ar Arabic ar-SA
bg Bulgarian bg-BG
ca Catalan ca-ES
zh-CHS Chinese (Simplified) (no associated specific culture)
cs Czech cs-CZ
da Danish da-DK
de German de-DE
el Greek el-GR
en English en-US
es Spanish es-ES
fi Finnish fi-FI
fr French fr-FR
he Hebrew he-IL
hu Hungarian hu-HU
is Icelandic is-IS
it Italian it-IT
ja Japanese ja-JP
ko Korean ko-KR
nl Dutch nl-NL
no Norwegian nb-NO
pl Polish pl-PL
pt Portuguese pt-BR
ro Romanian ro-RO
ru Russian ru-RU
hr Croatian hr-HR
sk Slovak sk-SK
sq Albanian sq-AL
sv Swedish sv-SE
th Thai th-TH
tr Turkish tr-TR
ur Urdu ur-PK
id Indonesian id-ID
uk Ukrainian uk-UA
be Belarusian be-BY
sl Slovenian sl-SI
et Estonian et-EE
lv Latvian lv-LV
lt Lithuanian lt-LT
fa Persian fa-IR
vi Vietnamese vi-VN
hy Armenian hy-AM
az Azeri az-Latn-AZ
*/
using namespace System;
using namespace System::Globalization;
int main()
{
// Prints the header.
Console::WriteLine( "CULTURE SPECIFIC CULTURE" );
// Determines the specific culture associated with each culture in the .NET Framework.
System::Collections::IEnumerator^ myEnum = CultureInfo::GetCultures( CultureTypes::AllCultures )->GetEnumerator();
while ( myEnum->MoveNext() )
{
CultureInfo^ ci = dynamic_cast<CultureInfo^>(myEnum->Current);
Console::Write( "{0, -12} {1, -40}", ci->Name, ci->EnglishName );
try
{
Console::WriteLine( "{0}", CultureInfo::CreateSpecificCulture( ci->Name )->Name );
}
catch ( Exception^ )
{
Console::WriteLine( "(no associated specific culture)" );
}
}
}
/*
This code produces the following output. This output has been cropped for brevity.
CULTURE SPECIFIC CULTURE
ar Arabic ar-SA
bg Bulgarian bg-BG
ca Catalan ca-ES
zh-CHS Chinese (Simplified) (no associated specific culture)
cs Czech cs-CZ
da Danish da-DK
de German de-DE
el Greek el-GR
en English en-US
es Spanish es-ES
fi Finnish fi-FI
fr French fr-FR
he Hebrew he-IL
hu Hungarian hu-HU
is Icelandic is-IS
it Italian it-IT
ja Japanese ja-JP
ko Korean ko-KR
nl Dutch nl-NL
no Norwegian nb-NO
pl Polish pl-PL
pt Portuguese pt-BR
ro Romanian ro-RO
ru Russian ru-RU
hr Croatian hr-HR
sk Slovak sk-SK
sq Albanian sq-AL
sv Swedish sv-SE
th Thai th-TH
tr Turkish tr-TR
ur Urdu ur-PK
id Indonesian id-ID
uk Ukrainian uk-UA
be Belarusian be-BY
sl Slovenian sl-SI
et Estonian et-EE
lv Latvian lv-LV
lt Lithuanian lt-LT
fa Persian fa-IR
vi Vietnamese vi-VN
hy Armenian hy-AM
az Azeri az-Latn-AZ
*/
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
.NET Compact Framework
Supported in: 3.5, 2.0, 1.0
XNA Framework
Supported in: 3.0, 2.0, 1.0
Reference