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

定义

将某项插入 IList 中指定的索引处。Inserts an item into the IList at the specified index.

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

参数

index
Int32

从零开始的索引,应在该索引处插入 valueThe zero-based index at which value should be inserted.

value
Object

要插入 ObjectIListThe Object to insert into the IList.

实现

异常

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

value 是一个无法赋值给 IList 的类型。value is of a type that is not assignable to the IList.

注解

如果 index 等于 IList 中的项数,则将 value 追加到末尾。If index equals the number of items in the IList, then value is appended to the end.

此方法是一个 O (n)操作,其中 nCount的。This method is an O(n) operation, where n is Count.

适用于