Bewerken

Delen via


ImmutableInterlocked.TryAdd<TKey,TValue> Method

Definition

Adds the specified key and value to the dictionary if the key is not in the dictionary.

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

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 with the specified key and value.

key
TKey

The key to add, if is not already defined in the dictionary.

value
TValue

The value to add.

Returns

true if the key is not in the dictionary; otherwise, false.

Applies to