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

定義

將項目插入 IList 中指定的索引處。

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

參數

index
Int32

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

value
Object

要插入 IListObject

實作

例外狀況

index 不是 IList 中的有效索引。

value 所屬類型無法指派給 IList

備註

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

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

適用於