Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

CultureInfo.LCID Property

Gets the culture identifier for the current CultureInfo.

[Visual Basic]
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;

Property Value

The culture identifier for the current CultureInfo.

Remarks

In most cases, the culture identifier is mapped to the corresponding National Language Support (NLS) locale identifier.

Example

[Visual Basic, C#, C++] The following code example shows how to create a CultureInfo for "Spanish - Spain" with the international sort and another CultureInfo with the traditional sort.

[Visual Basic] 
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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

CultureInfo Class | CultureInfo Members | System.Globalization Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.