Collection.IList.Insert(Int32, Object) Collection.IList.Insert(Int32, Object) Collection.IList.Insert(Int32, Object) Method


将项插入 Collection 对象中的指定索引处。Inserts an item to the Collection object at the specified index.

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


Int32 Int32 Int32

应插入 value 的从零开始的索引。The zero-based index at which value should be inserted.

Object Object Object

要插入到 Object 对象中的 CollectionThe Object to insert into the Collection object.


index 不是 Collection 对象中的有效索引。index is not a valid index in the Collection object.

Collection 对象是只读的。The Collection object is read-only.

-or- Collection 对象具有固定大小。The Collection object has a fixed size.

valueCollection 对象中为空引用。value is null reference in the Collection object.


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

在由连续的元素组成的集合(如列表)中,插入点下面的元素将下移以容纳新的元素。In collections of contiguous elements, such as lists, the elements that follow the insertion point move down to accommodate the new element. 如果集合具有索引,则移动的元素的索引也将更新。If the collection is indexed, the indexes of the elements that are moved are also updated. 此行为不适用于元素按概念划分为不同存储桶的集合,如哈希表。This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.