SynchronizedCollection<T>.InsertItem(Int32, T) 方法

定义

将项插入集合中的指定索引处。

protected:
 virtual void InsertItem(int index, T item);
protected virtual void InsertItem(int index, T item);
abstract member InsertItem : int * 'T -> unit
override this.InsertItem : int * 'T -> unit
Protected Overridable Sub InsertItem (index As Integer, item As T)

参数

index
Int32

要插入对象的集合的从零开始的索引。

item
T

要插入到集合中的对象。

例外

指定的 index 项数小于零或大于集合中的项数。

设置的值是 null 或不是集合的正确泛型类型 T

注解

如果等于 index 集合中的元素数,则该项将追加到列表中。 如果集合 index 中的元素数小于集合中的元素数,则项插入点后面的元素将向下移动以适应新元素。

适用于