StringCollection.IList.Remove(Object) 方法

定义

StringCollection 中移除特定对象的第一个匹配项。Removes the first occurrence of a specific object from the StringCollection.

 virtual void System.Collections.IList.Remove(System::Object ^ value) = System::Collections::IList::Remove;
void IList.Remove (object value);
void IList.Remove (object? value);
abstract member System.Collections.IList.Remove : obj -> unit
override this.System.Collections.IList.Remove : obj -> unit
Sub Remove (value As Object) Implements IList.Remove

参数

value
Object

要从 Object 移除的 StringCollectionThe Object to remove from the StringCollection. 该值可以为 nullThe value can be null.

实现

例外

StringCollection 为只读。The StringCollection is read-only.

- 或 --or- StringCollection 具有固定的大小。The StringCollection has a fixed size.

注解

如果不 StringCollection 包含指定的对象,则 StringCollection 保持不变。If the StringCollection does not contain the specified object, the StringCollection remains unchanged. 不会引发异常。No exception is thrown.

在由连续的元素组成的集合(如列表)中,已移除元素下面的元素将上移以占据空出的位置。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.

此方法通过调用来确定相等性 Object.EqualsThis method determines equality by calling Object.Equals.

此方法执行线性搜索;因此,此方法是 O (n) 操作,其中 nCountThis method performs a linear search; therefore, this method is an O(n) operation, where n is Count.

适用于

另请参阅