Method TryAdd
TryAdd(TKey, TValue)
Adds a new key-value pair.
Declaration
public bool TryAdd(TKey key, TValue item)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key to add. |
TValue | item | The value to add. |
Returns
Type | Description |
---|---|
bool | True if the key-value pair was added. |
Remarks
If the key is already present, this method returns false without modifying the hash map.