This topic has not yet been rated - Rate this topic

CultureInfo.TextInfo Property

Gets the TextInfo that defines the writing system associated with the culture.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)
'Declaration
Public Overridable ReadOnly Property TextInfo As TextInfo

Property Value

Type: System.Globalization.TextInfo
The TextInfo that defines the writing system associated with the culture.

The TextInfo property provides culture-specific casing information for strings. To perform culture-insensitive casing, the application should use the TextInfo property of InvariantCulture.

The following code example shows how to create a CultureInfo for Spanish (Spain) with the international sort order and another CultureInfo with the traditional sort order.

Imports System
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 'Main 



'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

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.