ImmutableInterlocked.TryAdd<TKey,TValue> Metod

Definition

Lägger till den angivna nyckeln och värdet i ordlistan om nyckeln inte finns i ordlistan.

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

Typparametrar

TKey

Typen av nycklar som finns i samlingen.

TValue

Typen av värden som finns i samlingen.

Parametrar

location
ImmutableDictionary<TKey,TValue>

Ordlistan som ska uppdateras med den angivna nyckeln och värdet.

key
TKey

Nyckeln som ska läggas till, om den inte redan har definierats i ordlistan.

value
TValue

Värdet som ska läggas till.

Returer

trueom nyckeln inte finns i ordlistan; annars . false

Gäller för