Edit

Share via


ConditionalWeakTable<TKey,TValue>.TryAdd(TKey, TValue) Method

Definition

Adds a key to the table if it doesn't already exist.

public bool TryAdd (TKey key, TValue value);

Parameters

key
TKey

The key to add.

value
TValue

The key's property value.

Returns

true if the key/value pair was added; false if the table already contained the key.

Applies to

Product Versions
.NET 7, 8, 9