Прочетете на английски Редактиране

Споделяне чрез


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.

C#
public static bool TryUpdate<TKey,TValue>(ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, TValue newValue, TValue comparisonValue);

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

Продукт Версии
.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 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)
UWP 10.0