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)
Syntax
'宣言
Function Insert ( _
position As Integer, _
characterBuffer As Char(), _
startIndex As Integer, _
length As Integer _
) As Boolean
bool Insert(
int position,
char[] characterBuffer,
int startIndex,
int length
)
bool Insert(
int position,
array<wchar_t>^ characterBuffer,
int startIndex,
int length
)
abstract Insert :
position:int *
characterBuffer:char[] *
startIndex:int *
length:int -> bool
function Insert(
position : int,
characterBuffer : char[],
startIndex : int,
length : int
) : boolean
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.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | characterBuffer is nulla null reference (Nothing in Visual Basic). |
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. |
Remarks
Inserting zero characters will succeed but will not generate a new snapshot or raise a Changed event.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.