ITextEdit::Insert Method (Int32, array<Char>^, Int32, Int32)

 

Inserts an array of characters at the specified position in the ITextBuffer.

Namespace:   Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

bool Insert(
	int position,
	array<wchar_t>^ characterBuffer,
	int startIndex,
	int length
)

Parameters

position
Type: System::Int32

The buffer position at which the first character of the text will appear.

characterBuffer
Type: array<System::Char>^

The character array from which characters will be inserted.

startIndex
Type: System::Int32

The index in characterBuffer of the first character to insert.

length
Type: System::Int32

The number of characters to insert from characterBuffer.

Return Value

Type: System::Boolean

true if the insertion succeeded, false if it was prevented by a read-only region.

Exception Condition
ArgumentNullException

characterBuffer is null.

InvalidOperationException

The Apply or Cancel or Dispose method has previously been called on this object.

ArgumentOutOfRangeException

position is less than zero or greater than the length of the buffer, or startIndex is less than zero, or length is less than zero, or startIndex + length is greater than the length of characterBuffer.

Inserting zero characters will succeed but will not generate a new snapshot or raise a Changed event.

Return to top
Show: