Editar

Compartilhar via


ImmutableInterlocked.TryUpdate<TKey,TValue> Method

Definition

Sets the specified key to the specified value if the specified key already is set to a specific value.

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

Type Parameters

TKey

The type of the keys contained in the collection.

TValue

The type of the values contained in the collection.

Parameters

location
ImmutableDictionary<TKey,TValue>

The dictionary to update.

key
TKey

The key to update.

newValue
TValue

The new value to set.

comparisonValue
TValue

The current value for key in order for the update to succeed.

Returns

true if key and comparisonValue are present in the dictionary and comparison was updated to newValue; otherwise, false.

Applies to