Collection.IList.RemoveAt(Int32) 方法

定義

移除指定之索引的 Collection 物件項目。Removes the Collection object item at the specified index.

 virtual void IListRemoveAt(int index) = System::Collections::IList::RemoveAt;
void IList.RemoveAt (int index);
Sub IListRemoveAt (index As Integer) Implements IList.RemoveAt

參數

index
Int32

要移除之項目的以零為起始的索引。The zero-based index of the item to remove.

例外狀況

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.

備註

在相鄰元素的集合中,例如清單,接在移除的元素之後的元素會向上移動以佔用空出的位置。In collections of contiguous elements, such as lists, the elements that follow the removed element move up to occupy the vacated spot. 如果集合具有索引,則移動之項目的索引也會更新。If the collection is indexed, the indexes of the elements that are moved are also updated. 集合的項目若在概念上群組成 Bucket (例如雜湊資料表),則不適用這項行為。This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.

適用於

另請參閱