Method TryAdd
TryAdd(TKey, TValue)
Attempts to add the specified key and value to the dictionary.
Declaration
public bool TryAdd(TKey key, TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | |
| TValue | value |
Returns
| Type | Description |
|---|---|
| bool | true if the key and value were added; false if the dictionary already contains the key with a value that is still available. |
Exceptions
| Type | Condition |
|---|---|
| ObjectDisposedException | The dictionary has been disposed. |