Export (0) Print
Expand All

CultureInfo.TextInfo Property

Gets the TextInfo object 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 object that defines the writing system associated with the culture.

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

The following example shows how to create two es-ES CultureInfo objects: one with the international sort order and another with the traditional sort order.


Imports System.Globalization

Public Module Example
   Public Sub Demo(outputBlock As System.Windows.Controls.TextBlock)
      outputBlock.FontFamily = New FontFamily("Courier New")

      ' Create and initialize an es-ES CultureInfo object with the international sort order.
      Dim ciIntl As New CultureInfo("es-ES")

      ' Create and initialize an es-ES CultureInfo object with the traditional sort order.
      Dim ciTrad As New CultureInfo("es-ES_tradnl")

      ' Display the properties of each culture.
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL") + vbCrLf
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "CompareInfo", ciIntl.CompareInfo, ciTrad.CompareInfo) + vbCrLf
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "DisplayName", ciIntl.DisplayName, ciTrad.DisplayName) + vbCrLf
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "EnglishName", ciIntl.EnglishName, ciTrad.EnglishName) + vbCrLf
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "Name", ciIntl.Name, ciTrad.Name) + vbCrLf
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "NativeName", ciIntl.NativeName, ciTrad.NativeName) + vbCrLf
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "Parent", ciIntl.Parent, ciTrad.Parent) + vbCrLf
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "TextInfo", ciIntl.TextInfo, ciTrad.TextInfo) + vbCrLf
      outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}", "TwoLetterISOLanguageName", ciIntl.TwoLetterISOLanguageName, ciTrad.TwoLetterISOLanguageName) + vbCrLf
      outputBlock.Text += vbCrLf

      ' Compare two strings using ciIntl.
      outputBlock.Text += String.Format("Comparing ""llegar"" and ""lugar""") + vbCrLf
      outputBlock.Text += String.Format("   With ciIntl.CompareInfo.Compare: {0}", ciIntl.CompareInfo.Compare("llegar", "lugar")) + vbCrLf
      outputBlock.Text += String.Format("   With ciTrad.CompareInfo.Compare: {0}", ciTrad.CompareInfo.Compare("llegar", "lugar")) + vbCrLf
   End Sub
End Module
' This example displays the following output:
'
' PROPERTY                    INTERNATIONAL                       TRADITIONAL
' CompareInfo                 CompareInfo - es-ES                 CompareInfo - es-ES_tradnl
' DisplayName                 Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort)
' EnglishName                 Spanish (Spain)                     Spanish (Spain)
' Name                        es-ES                               es-ES
' NativeName                  español (España)                    español (España)
' Parent                      es                                  es
' TextInfo                    TextInfo - es-ES                    TextInfo - es-ES_tradnl
' TwoLetterISOLanguageName    es                                  es
'
' Comparing "llegar" and "lugar"
'    With ciIntl.CompareInfo.Compare: -1
'    With ciTrad.CompareInfo.Compare: 1


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft