Dictionary<TKey,TValue>.KeyCollection.ICollection<TKey>.Remove 方法

定義

ICollection<T> 移除特定物件之第一個符合的元素。 這個實作一律會擲回 NotSupportedException

 virtual bool System.Collections.Generic.ICollection<TKey>.Remove(TKey item) = System::Collections::Generic::ICollection<TKey>::Remove;
bool ICollection<TKey>.Remove (TKey item);
abstract member System.Collections.Generic.ICollection<TKey>.Remove : 'Key -> bool
override this.System.Collections.Generic.ICollection<TKey>.Remove : 'Key -> bool
Function Remove (item As TKey) As Boolean Implements ICollection(Of TKey).Remove

參數

item
TKey

要從 ICollection<T> 移除的物件。

傳回

如果 true 已成功從 item 中移除,則為 ICollection<T>,否則為 false。 如果在原始的 ICollection<T> 中找不到項目,則這個方法也會傳回 false

實作

例外狀況

一律擲回。

備註

實作依判斷物件相等的方法會有所不同;例如,List<T> 使用 Default,而 Dictionary<TKey,TValue> 則讓使用者指定要用來比較索引鍵的 IComparer<T> 實作。

適用於

另請參閱