CollectionExtensions.Remove<TKey,TValue> 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
尝试从 dictionary
中删除具有指定的 key
的值。
public:
generic <typename TKey, typename TValue>
[System::Runtime::CompilerServices::Extension]
static bool Remove(System::Collections::Generic::IDictionary<TKey, TValue> ^ dictionary, TKey key, [Runtime::InteropServices::Out] TValue % value);
C#
public static bool Remove<TKey,TValue> (this System.Collections.Generic.IDictionary<TKey,TValue> dictionary, TKey key, out TValue value);
static member Remove : System.Collections.Generic.IDictionary<'Key, 'Value> * 'Key * 'Value -> bool
<Extension()>
Public Function Remove(Of TKey, TValue) (dictionary As IDictionary(Of TKey, TValue), key As TKey, ByRef value As TValue) As Boolean
- TKey
dictionary
中的键的类型。
- TValue
dictionary
的值的类型。
- dictionary
- IDictionary<TKey,TValue>
一个字典,其键类型为 TKey
,其值类型为 TValue
。
- key
- TKey
要删除的值的键。
- value
- TValue
如果此方法返回 true
,则为删除的值;此方法返回 false
时,则为 TValue
的 default
值。
如果在具有指定的 key
的 dictionary
中找到值,则为 true
;如果 dictionary
找不到与指定的 key
相关联的值,则为 false
。
dictionary
为 null
。
产品 | 版本 |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Standard | 2.1 |