List<T>.IList.Insert(Int32, Object) 方法

定義

將項目插入位於指定索引的 IList

 virtual void System.Collections.IList.Insert(int index, System::Object ^ item) = System::Collections::IList::Insert;
void IList.Insert (int index, object item);
abstract member System.Collections.IList.Insert : int * obj -> unit
override this.System.Collections.IList.Insert : int * obj -> unit
Sub Insert (index As Integer, item As Object) Implements IList.Insert

參數

index
Int32

應在 item 插入以零為起始的索引。

item
Object

要插入 IList 的物件。

實作

例外狀況

index 不是 IList 中的有效索引。

item 所屬類型無法指派給 IList

備註

如果 index 等於 IList 中的項目數目,則會將 item 附加至結尾。

這個方法是 o (n) 作業,其中 nCount

適用於