ImmutableInterlocked.TryUpdate<TKey,TValue> 方法

定義

如果指定的索引鍵已設定為指定的值,則將指定的索引鍵設定為指定的值。

public:
generic <typename TKey, typename TValue>
 static bool TryUpdate(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, TValue newValue, TValue comparisonValue);
public static bool TryUpdate<TKey,TValue> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, TValue newValue, TValue comparisonValue);
static member TryUpdate : ImmutableDictionary * 'Key * 'Value * 'Value -> bool
Public Shared Function TryUpdate(Of TKey, TValue) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, newValue As TValue, comparisonValue As TValue) As Boolean

類型參數

TKey

集合中所包含之索引鍵的類型。

TValue

集合中所包含之值的類型。

參數

location
ImmutableDictionary<TKey,TValue>

要更新的字典。

key
TKey

要更新的索引鍵。

newValue
TValue

要設定的新值。

comparisonValue
TValue

key 目前的值,以便讓更新成功。

傳回

如果字典中有 keycomparisonValue 且比較更新至則 newValue 則為 true,否則為 false

適用於