Share via


ImmutableInterlocked.TryAdd<TKey,TValue> Método

Definição

Adiciona a chave especificada e o valor ao dicionário se a chave não estiver no dicionário.

public:
generic <typename TKey, typename TValue>
 static bool TryAdd(System::Collections::Immutable::ImmutableDictionary<TKey, TValue> ^ % location, TKey key, TValue value);
public static bool TryAdd<TKey,TValue> (ref System.Collections.Immutable.ImmutableDictionary<TKey,TValue> location, TKey key, TValue value);
static member TryAdd : ImmutableDictionary * 'Key * 'Value -> bool
Public Shared Function TryAdd(Of TKey, TValue) (ByRef location As ImmutableDictionary(Of TKey, TValue), key As TKey, value 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 com a chave e o valor especificados.

key
TKey

A chave a ser adicionada, se ainda não estiver definida no dicionário.

value
TValue

O valor a ser adicionado.

Retornos

true se a chave não estiver no dicionário; caso contrário, false.

Aplica-se a