Share via


ImmutableInterlocked.TryUpdate<TKey,TValue> Método

Definição

Define a chave especificada com o valor especificado se a chave especificada já estiver definida com um valor específico.

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

Parâmetros de tipo

TKey

O tipo das chaves contidas na coleção.

TValue

O tipo dos valores contidos na coleção.

Parâmetros

location
ImmutableDictionary<TKey,TValue>

O dicionário a ser atualizado.

key
TKey

A chave a ser atualizada.

newValue
TValue

O novo valor a ser definido.

comparisonValue
TValue

O valor atual para key para que a atualização seja bem-sucedida.

Retornos

true se key e comparisonValue estiverem presentes no dicionário e a comparação for atualizada para newValue; caso contrário, false.

Aplica-se a