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

定義

將項目插入位於指定索引的 IListInserts an item to the IList at the specified index.

 virtual void System.Collections.IList.Insert(int index, System::Object ^ item) = System::Collections::IList::Insert;
void IList.Insert (int index, object item);
Sub Insert (index As Integer, item As Object) Implements IList.Insert

參數

index
Int32 Int32 Int32

應在 item 插入以零為起始的索引。The zero-based index at which item should be inserted.

item
Object Object Object

要插入 IList 的物件。The object to insert into the IList.

實作

例外狀況

index 不是 IList 中的有效索引。index is not a valid index in the IList.

item 屬於無法指派給 IList 的類型。item is of a type that is not assignable to the IList.

備註

如果 index 等於 IList 中的項目數目,則會將 item 附加至結尾。If index equals the number of items in the IList, then item is appended to the end.

這個方法是 O (n) 運算,其中nCountThis method is an O(n) operation, where n is Count.

適用於