ToString Method
Collapse the table of content
Expand the table of content

TextInfo.ToString Method

Returns a string that represents the current TextInfo.

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

Public Overrides Function ToString As String

Return Value

Type: System.String
A string that represents the current TextInfo.

This method overrides Object.ToString. It displays the name of the object, followed by a hyphen, followed by the name of the culture whose writing system the TextInfo object represents.

The following example calls the ToString method for TextInfo objects that represent the writing systems of several different cultures. The current system culture for the example is en-US.

Imports System.Globalization

Public Module Example
   Private outputBlock As System.Windows.Controls.TextBlock

   Public Sub Demo(ByVal outBlock As System.Windows.Controls.TextBlock)
      outputBlock = outBlock

      ShowTextInfoName((New CultureInfo("en")).TextInfo)
      ShowTextInfoName((New CultureInfo("fr-FR")).TextInfo)
      ShowTextInfoName((New CultureInfo("de-DE")).TextInfo)
   End Sub 

   Private Sub SHowTextInfoName(txt As TextInfo)
      outputBlock.Text &= txt.ToString() & vbCrLf
   End Sub   
End Module
' The example displays the following output:
'     TextInfo - en-US
'     TextInfo - 
'     TextInfo - en
'     TextInfo - fr-FR
'     TextInfo - de-DE   


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

© 2016 Microsoft