ConditionalWeakTable<TKey,TValue>.TryAdd(TKey, TValue) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a key to the table if it doesn't already exist.
public:
bool TryAdd(TKey key, TValue value);
public bool TryAdd (TKey key, TValue value);
member this.TryAdd : 'Key * 'Value -> bool
Public Function TryAdd (key As TKey, value As TValue) As Boolean
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
Samarbeta med oss på GitHub
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.