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 小於集合中的項目數目,則項目插入點後方的項目會向下移動,以容納新項目。

適用於