System.Globalization.TextInfo Class

Assembly: Mscorlib.dll
Namespace: System.Globalization
Summary
Defines properties and behaviors, such as casing, that are specific to a writing system.
C# Syntax:
[Serializable]
public class TextInfo : IDeserializationCallback
Remarks
A writing system is the collection of scripts and orthographic rules required to represent a language as text.

To create a TextInfo for any culture, use the CultureInfo.TextInfo property.

The user might choose to override some of the values associated with the current culture of Windows through Regional and Language Options (or Regional Options or Regional Settings) in Control Panel. For example, the user might choose to display the date in a different format or to use a currency other than the default for the culture. If the CultureInfo.UseUserOverride property is set to true, the properties of the CultureInfo.DateTimeFormat instance, the CultureInfo.NumberFormat instance, and the CultureInfo.TextInfo instance are also retrieved from the user settings. If the user settings are incompatible with the culture associated with the CultureInfo (for example, if the selected calendar is not one of the CultureInfo.OptionalCalendars), the results of the methods and the values of the properties are undefined.

See also:
System.Globalization Namespace | StringInfo

System.Globalization.TextInfo Member List:

Public Properties
ANSICodePage Read-only

Gets the American National Standards Institute (ANSI) code page used by the writing system represented by the current TextInfo.
EBCDICCodePage Read-only

Gets the Extended Binary Coded Decimal Interchange Code (EBCDIC) code page used by the writing system represented by the current TextInfo.
ListSeparator Read-only

Gets the string that separates items in a list.
MacCodePage Read-only

Gets the Macintosh code page used by the writing system represented by the current TextInfo.
OEMCodePage Read-only

Gets the original equipment manufacturer (OEM) code page used by the writing system represented by the current TextInfo.
Public Methods
Equals Overridden:
Determines whether the specified object represents the same writing system as the current TextInfo.
GetHashCode Overridden:
Serves as a hash function for the current TextInfo, suitable for use in hashing algorithms and data structures, such as a hash table.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToLower Overloaded:
ToLower(char c)

Converts the specified character to lowercase.
ToLower Overloaded:
ToLower(string str)

Converts the specified string to lowercase.
ToString Overridden:
Returns a string that represents the current TextInfo.
ToTitleCase Converts the specified string to titlecase.
ToUpper Overloaded:
ToUpper(char c)

Converts the specified character to uppercase.
ToUpper Overloaded:
ToUpper(string str)

Converts the specified string to uppercase.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Globalization.TextInfo Member Details

Property: ANSICodePage (read-only)
Summary
Gets the American National Standards Institute (ANSI) code page used by the writing system represented by the current TextInfo.
C# Syntax:
public virtual int ANSICodePage {get;}
See also:
TextInfo.OEMCodePage | TextInfo.MacCodePage | TextInfo.EBCDICCodePage

Return to top


Property: EBCDICCodePage (read-only)
Summary
Gets the Extended Binary Coded Decimal Interchange Code (EBCDIC) code page used by the writing system represented by the current TextInfo.
C# Syntax:
public virtual int EBCDICCodePage {get;}
See also:
TextInfo.ANSICodePage | TextInfo.OEMCodePage | TextInfo.MacCodePage

Return to top


Property: ListSeparator (read-only)
Summary
Gets the string that separates items in a list.
C# Syntax:
public virtual string ListSeparator {get;}
Remarks
The default for the invariant culture is ",".

Return to top


Property: MacCodePage (read-only)
Summary
Gets the Macintosh code page used by the writing system represented by the current TextInfo.
C# Syntax:
public virtual int MacCodePage {get;}
See also:
TextInfo.ANSICodePage | TextInfo.OEMCodePage | TextInfo.EBCDICCodePage

Return to top


Property: OEMCodePage (read-only)
Summary
Gets the original equipment manufacturer (OEM) code page used by the writing system represented by the current TextInfo.
C# Syntax:
public virtual int OEMCodePage {get;}
See also:
TextInfo.ANSICodePage | TextInfo.MacCodePage | TextInfo.EBCDICCodePage

Return to top


Overridden Method: Equals(
   object obj
)
Summary
Determines whether the specified object represents the same writing system as the current TextInfo.
C# Syntax:
public override bool Equals(
   object obj
);
Parameters:

obj

The object to compare with the current TextInfo.

Return Value:
true if obj represents the same writing system as the current TextInfo; otherwise, false.
Remarks
This method overrides Object.Equals.
See also:
Object.Equals

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~TextInfo();

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: GetHashCode()
Summary
Serves as a hash function for the current TextInfo, suitable for use in hashing algorithms and data structures, such as a hash table.
C# Syntax:
public override int GetHashCode();
Return Value:
A hash code for the current TextInfo.
Remarks
This method overrides Object.GetHashCode.

This method generates the same hash code for two objects that are equal according to the TextInfo.Equals method.

See also:
Object.GetHashCode | Hashtable | TextInfo.Equals

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overloaded Method: ToLower(
   char c
)
Summary
Converts the specified character to lowercase.
C# Syntax:
public virtual char ToLower(
   char c
);
Parameters:

c

The character to convert to lowercase.

Return Value:
The specified character converted to lowercase.
Remarks
Casing semantics depend on the culture in use. If using the invariant culture, the casing semantics are not culture-sensitive. If using a specific culture, the casing semantics are sensitive to that culture.

The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

For more information on cultures, see CultureInfo.

See also:
TextInfo.ToUpper | TextInfo.ToTitleCase

Return to top


Overloaded Method: ToLower(
   string str
)
Summary
Converts the specified string to lowercase.
C# Syntax:
public virtual string ToLower(
   string str
);
Parameters:

str

The string to convert to lowercase.

Return Value:
The specified string converted to lowercase.
Exceptions
Exception Type Condition
ArgumentNullException str is null.
Remarks
The returned string might differ in length from the input string. For more information on casing, refer to the Unicode Technical Report #21 "Case Mappings," published by the Unicode Consortium (http://www.unicode.org). The current implementation preserves the length of the string; however, this behavior is not guaranteed and could change in future implementations.

Casing semantics depend on the culture in use. If using the invariant culture, the casing semantics are not culture-sensitive. If using a specific culture, the casing semantics are sensitive to that culture.

The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

For more information on cultures, see CultureInfo.

See also:
TextInfo.ToUpper | TextInfo.ToTitleCase

Return to top


Overridden Method: ToString()
Summary
Returns a string that represents the current TextInfo.
C# Syntax:
public override string ToString();
Return Value:
A string that represents the current TextInfo.
Remarks
This method overrides Object.ToString.
See also:
Object.ToString | String

Return to top


Method: ToTitleCase(
   string str
)
Summary
Converts the specified string to titlecase.
C# Syntax:
public string ToTitleCase(
   string str
);
Parameters:

str

The string to convert to titlecase.

Return Value:
The specified string converted to titlecase.
Exceptions
Exception Type Condition
ArgumentNullException str is null.
Remarks
Generally, title casing converts the first character of a word to uppercase and converts the rest of the letters to lowercase.

The returned string might differ in length from the input string. For more information on casing, refer to the Unicode Technical Report #21 "Case Mappings," published by the Unicode Consortium (http://www.unicode.org). The current implementation preserves the length of the string; however, this behavior is not guaranteed and could change in future implementations.

Casing semantics depend on the culture in use. If using the invariant culture, the casing semantics are not culture-sensitive. If using a specific culture, the casing semantics are sensitive to that culture. Words that are selected for title casing depend on the language.

The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

For more information on cultures, see CultureInfo.

See also:
TextInfo.ToLower | TextInfo.ToUpper

Return to top


Overloaded Method: ToUpper(
   char c
)
Summary
Converts the specified character to uppercase.
C# Syntax:
public virtual char ToUpper(
   char c
);
Parameters:

c

The character to convert to uppercase.

Return Value:
The specified character converted to uppercase.
Remarks
Casing semantics depend on the culture in use. If using the invariant culture, the casing semantics are not culture-sensitive. If using a specific culture, the casing semantics are sensitive to that culture.

The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

For more information on cultures, see CultureInfo.

See also:
TextInfo.ToLower | TextInfo.ToTitleCase

Return to top


Overloaded Method: ToUpper(
   string str
)
Summary
Converts the specified string to uppercase.
C# Syntax:
public virtual string ToUpper(
   string str
);
Parameters:

str

The string to convert to uppercase.

Return Value:
The specified string converted to uppercase.
Exceptions
Exception Type Condition
ArgumentNullException str is null.
Remarks
The returned string might differ in length from the input string. For more information on casing, refer to the Unicode Technical Report #21 "Case Mappings," published by the Unicode Consortium (http://www.unicode.org). The current implementation preserves the length of the string; however, this behavior is not guaranteed and could change in future implementations.

Casing semantics depend on the culture in use. If using the invariant culture, the casing semantics are not culture-sensitive. If using a specific culture, the casing semantics are sensitive to that culture.

The invariant culture must be used only by processes that require culture-independent results, such as system services; otherwise, it produces results that might be linguistically incorrect or culturally inappropriate.

For more information on cultures, see CultureInfo.

See also:
TextInfo.ToLower | TextInfo.ToTitleCase

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.