語言

StringCollection.IList.Remove(Object) 方法

定義

從 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從 中移除StringCollection。 其值可以是 null。

實作

例外狀況

這是 StringCollection 唯讀的。

-或-

它 StringCollection 有固定尺寸。

備註

若 不 StringCollection 包含指定物件,則保持 StringCollection 不變。 沒例外拋出。

在連續元素的集合中,例如列表,緊接被移除元素後的元素會往上移動,佔據空出的位置。 若集合被索引,移動元素的索引也會同步更新。 此行為不適用於將元素概念上分組為桶的集合,例如雜湊表。

此方法透過呼叫 Object.Equals來判定等號。

此方法執行線性搜尋;因此,此方法是一個 O(n) 運算,其中 n 為 Count。

適用於

另請參閱