插入一个字符数组在 ITextBuffer的指定位置。
命名空间: Microsoft.VisualStudio.Text
程序集: Microsoft.VisualStudio.Text.Data(在 Microsoft.VisualStudio.Text.Data.dll 中)
语法
声明
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
参数
position
类型:Int32将在其中显示文本的第一个字符的缓冲区位置。
characterBuffer
类型:array<Char[]将向其中插入字符的字符数组。
startIndex
类型:Int32characterBuffer 中要插入的第一个字符的索引。
length
类型:Int32要从 characterBuffer 插入的字符数。
返回值
类型:Boolean
如果插入成功,则为 true;如果插入被只读区域阻止,则为 false。
异常
异常 | 条件 |
---|---|
ArgumentNullException | characterBuffer 为 nullnull 引用(在 Visual Basic 中为 Nothing)。 |
InvalidOperationException | |
ArgumentOutOfRangeException | position 大于零的小于或大于缓冲区的长度,或者 startIndex 小于零,或 length 小于零,或 startIndex + length 大于 characterBuffer的长度。 |
备注
插入字符将会成功,而不会生成一个新的快照也不会引发 Changed 事件。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。