Method TryAdd
TryAdd(TKey, TValue)
Attempts to add the specified key and value to the dictionary.
public bool TryAdd(TKey key, TValue value)
Parameters
key
TKeyThe key of the element to add.
value
TValueThe value of the element to add. It can be null.
Returns
- bool
true if the key/value pair was added to the dictionary successfully; otherwise, false.