ImmutableInterlocked.TryRemove<TKey,TValue> 方法

定义

移除具有指定键的元素(如果该键存在)。

public:
generic <typename TKey, typename TValue>
 static bool TryRemove(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, [Runtime::InteropServices::Out] TValue % value);
public static bool TryRemove<TKey,TValue> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, out TValue value);
static member TryRemove : ImmutableDictionary * 'Key * 'Value -> bool
Public Shared Function TryRemove(Of TKey, TValue) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, ByRef value As TValue) As Boolean

类型参数

TKey

集合中包含的键的类型。

TValue

集合中包含的值的类型。

参数

location
ImmutableDictionary<TKey,TValue>

要更新的字典。

key
TKey

要移除的键。

value
TValue

如果字典不为空,则接收已移除项的值。

返回

如果找到并移除了该键,则为 true;否则为 false

适用于