TextInfo.ToString Method

Returns a string that represents the current TextInfo.

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

public override string ToString()

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.

using System;
using System.Globalization;

public class Example
   private static System.Windows.Controls.TextBlock outputBlock;

   public static void Demo(System.Windows.Controls.TextBlock outBlock)
      outputBlock = outBlock;

      ShowTextInfoName((new CultureInfo("en")).TextInfo);
      ShowTextInfoName((new CultureInfo("fr-FR")).TextInfo);
      ShowTextInfoName((new CultureInfo("de-DE")).TextInfo);

   private static void ShowTextInfoName(TextInfo txt)
      outputBlock.Text += txt.ToString() + "\n";
//     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