Information
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.

StringInfo.SubstringByTextElements Method (Int32, Int32)

Retrieves a substring of text elements from the current StringInfo object starting from a specified text element and continuing through the specified number of text elements.

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

public string SubstringByTextElements(
	int startingTextElement,
	int lengthInTextElements
)

Parameters

startingTextElement
Type: System.Int32

The zero-based index of a text element in this StringInfo object.

lengthInTextElements
Type: System.Int32

The number of text elements to retrieve.

Return Value

Type: System.String
A substring of text elements in this StringInfo object. The substring consists of the number of text elements specified by the lengthInTextElements parameter and starts from the text element index specified by the startingTextElement parameter.

ExceptionCondition
ArgumentOutOfRangeException

startingTextElement is less than zero.

-or-

startingTextElement is greater than or equal to the length of the string that is the value of the current StringInfo object.

-or-

lengthInTextElements is less than zero.

-or-

The string that is the value of the current StringInfo object is the empty string ("").

-or-

startingTextElement + lengthInTextElements specify an index that is greater than the number of text elements in this StringInfo object.

Consider a string that consists of five text elements, indexed from 0 through 4. If the startingTextElement parameter is 1 and the lengthInTextElements parameter is 3, the SubstringByTextElements method returns a substring that consists of the text elements for which the indexes are 1, 2, and 3.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft