Dictionary<TKey,TValue>.KeyCollection.ICollection<TKey>.Remove 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從 ICollection<T> 移除特定物件之第一個符合的元素。 這個實作一律會擲回 NotSupportedException。
virtual bool System.Collections.Generic.ICollection<TKey>.Remove(TKey item) = System::Collections::Generic::ICollection<TKey>::Remove;
C#
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> 實作。
產品 | 版本 |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |