CultureInfo.TextInfo Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the TextInfo object that defines the writing system associated with the culture.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Globalization.TextInfoThe 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.
using System; using System.Globalization; using System.Windows.Media; public class Example { public static void Demo(System.Windows.Controls.TextBlock outputBlock) { outputBlock.FontFamily = new FontFamily("Courier New"); // Create and initialize an es-ES CultureInfo object with the international sort order. CultureInfo ciIntl = new CultureInfo("es-ES"); // Create and initialize an es-ES CultureInfo object with the traditional sort order. CultureInfo ciTrad = new CultureInfo("es-ES_tradnl"); // Display the properties of each culture. outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "PROPERTY", "INTERNATIONAL", "TRADITIONAL"); outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "CompareInfo", ciIntl.CompareInfo, ciTrad.CompareInfo); outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "DisplayName", ciIntl.DisplayName, ciTrad.DisplayName); outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "EnglishName", ciIntl.EnglishName, ciTrad.EnglishName); outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "Name", ciIntl.Name, ciTrad.Name); outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "NativeName", ciIntl.NativeName, ciTrad.NativeName); outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "Parent", ciIntl.Parent, ciTrad.Parent); outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "TextInfo", ciIntl.TextInfo, ciTrad.TextInfo); outputBlock.Text += String.Format("{0,-28}{1,-35}{2,-35}\n", "TwoLetterISOLanguageName", ciIntl.TwoLetterISOLanguageName, ciTrad.TwoLetterISOLanguageName); outputBlock.Text += "\n"; // Compare two strings using ciIntl. outputBlock.Text += String.Format("Comparing \"llegar\" and \"lugar\"\n"); outputBlock.Text += String.Format(" With ciIntl.CompareInfo.Compare: {0}\n", ciIntl.CompareInfo.Compare("llegar", "lugar")); outputBlock.Text += String.Format(" With ciTrad.CompareInfo.Compare: {0}\n", ciTrad.CompareInfo.Compare("llegar", "lugar")); } } // 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