TextInfo.ToString Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Returns a string that represents the current TextInfo.
Assembly: mscorlib (in mscorlib.dll)
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(CultureInfo.CurrentCulture.TextInfo); ShowTextInfoName(CultureInfo.InvariantCulture.TextInfo); 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