CultureInfo.LCID プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
現在の CultureInfo のカルチャ識別子を取得します。
public:
virtual property int LCID { int get(); };
public virtual int LCID { get; }
member this.LCID : int
Public Overridable ReadOnly Property LCID As Integer
プロパティ値
現在の CultureInfo のカルチャ識別子。
例
次のコード例は、国際並べ替え順序でスペイン語 (スペイン) 用を作成し、もう 1 つCultureInfoを従来の並べ替え順序で作成CultureInfoする方法を示しています。
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 = gcnew CultureInfo( "es-ES",false );
// Creates and initializes the CultureInfo which uses the traditional sort.
CultureInfo^ myCItrad = gcnew CultureInfo( 0x040A,false );
// Displays the properties of each culture.
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL" );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "CompareInfo", myCIintl->CompareInfo, myCItrad->CompareInfo );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "DisplayName", myCIintl->DisplayName, myCItrad->DisplayName );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "EnglishName", myCIintl->EnglishName, myCItrad->EnglishName );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "IsNeutralCulture", myCIintl->IsNeutralCulture, myCItrad->IsNeutralCulture );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "IsReadOnly", myCIintl->IsReadOnly, myCItrad->IsReadOnly );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "LCID", myCIintl->LCID, myCItrad->LCID );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "Name", myCIintl->Name, myCItrad->Name );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "NativeName", myCIintl->NativeName, myCItrad->NativeName );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "Parent", myCIintl->Parent, myCItrad->Parent );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "TextInfo", myCIintl->TextInfo, myCItrad->TextInfo );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "ThreeLetterISOLanguageName", myCIintl->ThreeLetterISOLanguageName, myCItrad->ThreeLetterISOLanguageName );
Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl->ThreeLetterWindowsLanguageName, myCItrad->ThreeLetterWindowsLanguageName );
Console::WriteLine( "{0,-31}{1,-47}{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 - es-ES CompareInfo - es-ES_tradnl
DisplayName Spanish (Spain) Spanish (Spain)
EnglishName Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort)
IsNeutralCulture False False
IsReadOnly False False
LCID 3082 1034
Name es-ES es-ES
NativeName Español (España, alfabetización internacional) Español (España, alfabetización tradicional)
Parent es es
TextInfo TextInfo - es-ES TextInfo - es-ES_tradnl
ThreeLetterISOLanguageName spa spa
ThreeLetterWindowsLanguageName ESN ESP
TwoLetterISOLanguageName es es
Comparing "llegar" and "lugar"
With myCIintl -> CompareInfo -> Compare: -1
With myCItrad -> CompareInfo -> Compare: 1
*/
using System;
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,-31}{1,-47}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL");
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "CompareInfo", myCIintl.CompareInfo, myCItrad.CompareInfo);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "DisplayName", myCIintl.DisplayName, myCItrad.DisplayName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "EnglishName", myCIintl.EnglishName, myCItrad.EnglishName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "IsNeutralCulture", myCIintl.IsNeutralCulture, myCItrad.IsNeutralCulture);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "IsReadOnly", myCIintl.IsReadOnly, myCItrad.IsReadOnly);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "LCID", myCIintl.LCID, myCItrad.LCID);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "Name", myCIintl.Name, myCItrad.Name);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "NativeName", myCIintl.NativeName, myCItrad.NativeName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "Parent", myCIintl.Parent, myCItrad.Parent);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "TextInfo", myCIintl.TextInfo, myCItrad.TextInfo);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "ThreeLetterISOLanguageName", myCIintl.ThreeLetterISOLanguageName, myCItrad.ThreeLetterISOLanguageName);
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl.ThreeLetterWindowsLanguageName, myCItrad.ThreeLetterWindowsLanguageName);
Console.WriteLine("{0,-31}{1,-47}{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 - es-ES CompareInfo - es-ES_tradnl
DisplayName Spanish (Spain) Spanish (Spain)
EnglishName Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort)
IsNeutralCulture False False
IsReadOnly False False
LCID 3082 1034
Name es-ES es-ES
NativeName Español (España, alfabetización internacional) Español (España, alfabetización tradicional)
Parent es es
TextInfo TextInfo - es-ES TextInfo - es-ES_tradnl
ThreeLetterISOLanguageName spa spa
ThreeLetterWindowsLanguageName ESN ESP
TwoLetterISOLanguageName es es
Comparing "llegar" and "lugar"
With myCIintl.CompareInfo.Compare: -1
With myCItrad.CompareInfo.Compare: 1
*/
Imports System.Collections
Imports System.Globalization
Module Module1
Public 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,-31}{1,-47}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL")
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "CompareInfo", myCIintl.CompareInfo, myCItrad.CompareInfo)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "DisplayName", myCIintl.DisplayName, myCItrad.DisplayName)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "EnglishName", myCIintl.EnglishName, myCItrad.EnglishName)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "IsNeutralCulture", myCIintl.IsNeutralCulture, myCItrad.IsNeutralCulture)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "IsReadOnly", myCIintl.IsReadOnly, myCItrad.IsReadOnly)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "LCID", myCIintl.LCID, myCItrad.LCID)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "Name", myCIintl.Name, myCItrad.Name)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "NativeName", myCIintl.NativeName, myCItrad.NativeName)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "Parent", myCIintl.Parent, myCItrad.Parent)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "TextInfo", myCIintl.TextInfo, myCItrad.TextInfo)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "ThreeLetterISOLanguageName", myCIintl.ThreeLetterISOLanguageName, myCItrad.ThreeLetterISOLanguageName)
Console.WriteLine("{0,-31}{1,-47}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl.ThreeLetterWindowsLanguageName, myCItrad.ThreeLetterWindowsLanguageName)
Console.WriteLine("{0,-31}{1,-47}{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
'This code produces the following output.
'
'PROPERTY INTERNATIONAL TRADITIONAL
'CompareInfo CompareInfo - es-ES CompareInfo - es-ES_tradnl
'DisplayName Spanish (Spain) Spanish (Spain)
'EnglishName Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort)
'IsNeutralCulture False False
'IsReadOnly False False
'LCID 3082 1034
'Name es-ES es-ES
'NativeName Español (España, alfabetización internacional) Español (España, alfabetización tradicional)
'Parent es es
'TextInfo TextInfo - es-ES TextInfo - es-ES_tradnl
'ThreeLetterISOLanguageName spa spa
'ThreeLetterWindowsLanguageName ESN ESP
'TwoLetterISOLanguageName es es
'
'Comparing "llegar" and "lugar"
' With myCIintl.CompareInfo.Compare: -1
' With myCItrad.CompareInfo.Compare: 1
End Module
注釈
ほとんどの場合、カルチャ識別子は対応する NLS ロケール識別子にマップされます。
Windows 10より前のバージョンの Windows では、ロケール識別子 LOCALE_CUSTOM_UNSPECIFIED
(0x1000、または 4096) が、ユーザーによって作成されたカスタム カルチャに割り当てられます。 Windows 10以降、一意のロケール識別子を持たないカルチャに割り当てられ、完全なシステム指定データを持たないカルチャに割り当てられます。 その結果、カルチャを反復処理し、 のLOCALE_CUSTOM_UNSPECIFIED
値をLCID持つものを取得するコードは、Windows 10で実行すると、より大きなオブジェクトのCultureInfoサブセットを返します。
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET