Mono Class Library: System.Text.StringBuilder Overview | Members

System.Text.StringBuilder.Insert Method

Inserts the string representation of a subarray of Unicode characters into the current instance at a specified index. [Edit]

public StringBuilder Insert (int index, char[] value, int startIndex, int charCount)

Parameters

index
A int containing the index at which to insert. [Edit]
value
The char array from which to get the characters to be inserted. [Edit]
startIndex
A int containing the starting index within value. [Edit]
charCount
A int containing the number of characters to insert from value. [Edit]

Returns

The current instance after insertion has occurred. [Edit]

Exceptions

TypeReason
ArgumentNullExceptionvalue is a null reference, and startIndex and charCount are not both zero. [Edit]
ArgumentOutOfRangeException

index is greater than the length of the current instance or less than zero.

-or-

startIndex or charCount is less than zero or their sum is greater than the length of value.

[Edit]

Remarks

This method inserts the specified range of characters from value array into the current instance in the same order as they appear in value. Existing characters are shifted to make room for the new text, and StringBuilder.Capacity is adjusted as necessary.

If value is an empty array or a null reference and startIndex and charCount are both zero, the System.Text.StringBuilder is not changed.

[Edit]

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0