IList<T>.RemoveAt(Int32) 方法

定义

移除位于指定索引处的 IList<T> 项。Removes the IList<T> item at the specified index.

public:
 void RemoveAt(int index);
public void RemoveAt (int index);
abstract member RemoveAt : int -> unit
Public Sub RemoveAt (index As Integer)

参数

index
Int32

要移除的项的从零开始的索引。The zero-based index of the item to remove.

异常

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

IList<T> 为只读。The IList<T> is read-only.

注解

在由连续的元素组成的集合(如列表)中,已移除元素下面的元素将上移以占据空出的位置。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. 此行为不适用于元素按概念划分为不同存储桶的集合,如哈希表。This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.

适用于

另请参阅