Insert Method (Int32, Char[])

StringBuilder.Insert Method (Int32, Char[])


Inserts the string representation of a specified array of Unicode characters into this instance at the specified character position.

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

member Insert : 
        index:int *
        value:char[] -> StringBuilder


Type: System.Int32

The position in this instance where insertion begins.

Type: System.Char[]

The character array to insert.

Return Value

Type: System.Text.StringBuilder

A reference to this instance after the insert operation has completed.

Exception Condition

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


Enlarging the value of this instance would exceed MaxCapacity.

Existing characters are shifted to make room for the new text. The capacity of this instance is adjusted as needed.

If value is null, the StringBuilder is not changed.

The following example demonstrates the Insert method.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2016 Microsoft