语言

IListContract<T>.Insert(Int32, T) 方法

定义

在集合中的指定索引处插入项 IListContract<T> 。

public:
 void Insert(int index, T item);
public void Insert(int index, T item);
abstract member Insert : int * 'T -> unit
Public Sub Insert (index As Integer, item As T)

参数

index
Int32

要插入 item的从零开始的索引。

item
T

要 IContract 插入集合中的 IListContract<T> 对象。

例外

index 小于零。

-或-

index 等于或大于返回值 GetCount()。

注解

调用 Insert 该方法后,插入点后面的项将移动以适应新项。 移动的项的索引也会更新。 若要替换指定索引处的项,请使用 SetItem 该方法。

若要确定集合是否 IListContract<T> 为只读,请调用该方法 GetIsReadOnly 。

适用于