Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CultureInfo.TextInfo Property

Gets the TextInfo object that defines the writing system associated with the culture.

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

public virtual TextInfo TextInfo { get; }

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.

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


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

© 2017 Microsoft