CultureInfo.LCID プロパティ
現在の CultureInfo のカルチャ識別子を取得します。
Public Overridable ReadOnly Property LCID As Integer
[C#]
public virtual int LCID {get;}
[C++]
public: __property virtual int get_LCID();
[JScript]
public function get LCID() : int;
プロパティ値
現在の CultureInfo のカルチャ識別子。
解説
ほとんどの場合、カルチャ識別子は、対応する国別言語サポート (NLS: National Language Support) ロケール識別子に割り当てられます。
使用例
[Visual Basic, C#, C++] "スペイン語 - スペイン" の国際並べ替え順序用の CultureInfo と、従来の並べ替え順序用のもう 1 つの CultureInfo を作成するコードの例を次に示します。
Imports System
Imports System.Collections
Imports System.Globalization
Public Class SamplesCultureInfo
Public Shared Sub Main()
' Creates and initializes the CultureInfo which uses the international sort.
Dim myCIintl As New CultureInfo("es-ES", False)
' Creates and initializes the CultureInfo which uses the traditional sort.
Dim myCItrad As New CultureInfo(&H40A, False)
' Displays the properties of each culture.
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL")
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "CompareInfo", myCIintl.CompareInfo, myCItrad.CompareInfo)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "DisplayName", myCIintl.DisplayName, myCItrad.DisplayName)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "EnglishName", myCIintl.EnglishName, myCItrad.EnglishName)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "IsNeutralCulture", myCIintl.IsNeutralCulture, myCItrad.IsNeutralCulture)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "IsReadOnly", myCIintl.IsReadOnly, myCItrad.IsReadOnly)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "LCID", myCIintl.LCID, myCItrad.LCID)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "Name", myCIintl.Name, myCItrad.Name)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "NativeName", myCIintl.NativeName, myCItrad.NativeName)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "Parent", myCIintl.Parent, myCItrad.Parent)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "TextInfo", myCIintl.TextInfo, myCItrad.TextInfo)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "ThreeLetterISOLanguageName", myCIintl.ThreeLetterISOLanguageName, myCItrad.ThreeLetterISOLanguageName)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl.ThreeLetterWindowsLanguageName, myCItrad.ThreeLetterWindowsLanguageName)
Console.WriteLine("{0,-33}{1,-25}{2,-25}", "TwoLetterISOLanguageName", myCIintl.TwoLetterISOLanguageName, myCItrad.TwoLetterISOLanguageName)
Console.WriteLine()
' Compare two strings using myCIintl.
Console.WriteLine("Comparing ""llegar"" and ""lugar""")
Console.WriteLine(" With myCIintl.CompareInfo.Compare: {0}", myCIintl.CompareInfo.Compare("llegar", "lugar"))
Console.WriteLine(" With myCItrad.CompareInfo.Compare: {0}", myCItrad.CompareInfo.Compare("llegar", "lugar"))
End Sub 'Main
End Class 'SamplesCultureInfo
'This code produces the following output.
'
'PROPERTY INTERNATIONAL TRADITIONAL
'CompareInfo CompareInfo - 3082 CompareInfo - 1034
'DisplayName Spanish (Spain) Spanish (Spain)
'EnglishName Spanish (Spain) Spanish (Spain)
'IsNeutralCulture False False
'IsReadOnly False False
'LCID 3082 1034
'Name es-ES es-ES
'NativeName espaol (Espaa) espaol (Espaa)
'Parent es es
'TextInfo TextInfo - 3082 TextInfo - 1034
'ThreeLetterISOLanguageName spa spa
'ThreeLetterWindowsLanguageName ESN ESN
'TwoLetterISOLanguageName es es
'
'Comparing "llegar" and "lugar"
' With myCIintl.CompareInfo.Compare: -1
' With myCItrad.CompareInfo.Compare: 1
[C#]
using System;
using System.Collections;
using System.Globalization;
public class SamplesCultureInfo {
public static void Main() {
// Creates and initializes the CultureInfo which uses the international sort.
CultureInfo myCIintl = new CultureInfo( "es-ES", false );
// Creates and initializes the CultureInfo which uses the traditional sort.
CultureInfo myCItrad = new CultureInfo( 0x040A, false );
// Displays the properties of each culture.
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL" );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "CompareInfo", myCIintl.CompareInfo, myCItrad.CompareInfo );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "DisplayName", myCIintl.DisplayName, myCItrad.DisplayName );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "EnglishName", myCIintl.EnglishName, myCItrad.EnglishName );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "IsNeutralCulture", myCIintl.IsNeutralCulture, myCItrad.IsNeutralCulture );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "IsReadOnly", myCIintl.IsReadOnly, myCItrad.IsReadOnly );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "LCID", myCIintl.LCID, myCItrad.LCID );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "Name", myCIintl.Name, myCItrad.Name );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "NativeName", myCIintl.NativeName, myCItrad.NativeName );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "Parent", myCIintl.Parent, myCItrad.Parent );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "TextInfo", myCIintl.TextInfo, myCItrad.TextInfo );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "ThreeLetterISOLanguageName", myCIintl.ThreeLetterISOLanguageName, myCItrad.ThreeLetterISOLanguageName );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl.ThreeLetterWindowsLanguageName, myCItrad.ThreeLetterWindowsLanguageName );
Console.WriteLine( "{0,-33}{1,-25}{2,-25}", "TwoLetterISOLanguageName", myCIintl.TwoLetterISOLanguageName, myCItrad.TwoLetterISOLanguageName );
Console.WriteLine();
// Compare two strings using myCIintl.
Console.WriteLine( "Comparing \"llegar\" and \"lugar\"" );
Console.WriteLine( " With myCIintl.CompareInfo.Compare: {0}", myCIintl.CompareInfo.Compare( "llegar", "lugar" ) );
Console.WriteLine( " With myCItrad.CompareInfo.Compare: {0}", myCItrad.CompareInfo.Compare( "llegar", "lugar" ) );
}
}
/*
This code produces the following output.
PROPERTY INTERNATIONAL TRADITIONAL
CompareInfo CompareInfo - 3082 CompareInfo - 1034
DisplayName Spanish (Spain) Spanish (Spain)
EnglishName Spanish (Spain) Spanish (Spain)
IsNeutralCulture False False
IsReadOnly False False
LCID 3082 1034
Name es-ES es-ES
NativeName espaol (Espaa) espaol (Espaa)
Parent es es
TextInfo TextInfo - 3082 TextInfo - 1034
ThreeLetterISOLanguageName spa spa
ThreeLetterWindowsLanguageName ESN ESN
TwoLetterISOLanguageName es es
Comparing "llegar" and "lugar"
With myCIintl.CompareInfo.Compare: -1
With myCItrad.CompareInfo.Compare: 1
*/
[C++]
#using <mscorlib.dll>
using namespace System;
using namespace System::Collections;
using namespace System::Globalization;
int main()
{
// Creates and initializes the CultureInfo which uses the international sort.
CultureInfo* myCIintl = new CultureInfo(S"es-ES", false);
// Creates and initializes the CultureInfo which uses the traditional sort.
CultureInfo* myCItrad = new CultureInfo(0x040A, false);
// Displays the properties of each culture.
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"PROPERTY", S"INTERNATIONAL", S"TRADITIONAL");
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"CompareInfo", myCIintl -> CompareInfo, myCItrad -> CompareInfo);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"DisplayName", myCIintl -> DisplayName, myCItrad -> DisplayName);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"EnglishName", myCIintl -> EnglishName, myCItrad -> EnglishName);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"IsNeutralCulture", __box(myCIintl -> IsNeutralCulture), __box(myCItrad -> IsNeutralCulture));
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"IsReadOnly", __box(myCIintl -> IsReadOnly), __box(myCItrad -> IsReadOnly));
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"LCID", __box(myCIintl -> LCID), __box(myCItrad -> LCID));
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"Name", myCIintl -> Name, myCItrad -> Name);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"NativeName", myCIintl -> NativeName, myCItrad -> NativeName);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"Parent", myCIintl -> Parent, myCItrad -> Parent);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"TextInfo", myCIintl -> TextInfo, myCItrad -> TextInfo);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"ThreeLetterISOLanguageName", myCIintl -> ThreeLetterISOLanguageName, myCItrad -> ThreeLetterISOLanguageName);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"ThreeLetterWindowsLanguageName", myCIintl -> ThreeLetterWindowsLanguageName, myCItrad -> ThreeLetterWindowsLanguageName);
Console::WriteLine(S"{0,-33}{1,-25}{2,-25}", S"TwoLetterISOLanguageName", myCIintl -> TwoLetterISOLanguageName, myCItrad -> TwoLetterISOLanguageName);
Console::WriteLine();
// Compare two strings using myCIintl ->
Console::WriteLine(S"Comparing \"llegar\" and \"lugar\"");
Console::WriteLine(S" With myCIintl -> CompareInfo -> Compare: {0}", __box(myCIintl -> CompareInfo -> Compare(S"llegar", S"lugar")));
Console::WriteLine(S" With myCItrad -> CompareInfo -> Compare: {0}", __box(myCItrad -> CompareInfo -> Compare(S"llegar", S"lugar")));
}
/*
This code produces the following output.
PROPERTY INTERNATIONAL TRADITIONAL
CompareInfo CompareInfo - 3082 CompareInfo - 1034
DisplayName Spanish (Spain) Spanish (Spain)
EnglishName Spanish (Spain) Spanish (Spain)
IsNeutralCulture False False
IsReadOnly False False
LCID 3082 1034
Name es-ES es-ES
NativeName espaol (Espaa) espaol (Espaa)
Parent es es
TextInfo TextInfo - 3082 TextInfo - 1034
ThreeLetterISOLanguageName spa spa
ThreeLetterWindowsLanguageName ESN ESN
TwoLetterISOLanguageName es es
Comparing "llegar" and "lugar"
With myCIintl -> CompareInfo -> Compare: -1
With myCItrad -> CompareInfo -> Compare: 1
*/
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
CultureInfo クラス | CultureInfo メンバ | System.Globalization 名前空間