Method UpdateOrAdd
UpdateOrAdd(K, V)
Update value in dictionary corresponding to key if found, else add new entry. More general than "this[key] = val;" by reporting if key was found.
Declaration
bool UpdateOrAdd(K key, V val)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
V | val | The value to add or replace with. |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found and value updated. |
UpdateOrAdd(K, V, out V)
Update value in dictionary corresponding to key if found, else add new entry. More general than "this[key] = val;" by reporting if key was found.
Declaration
bool UpdateOrAdd(K key, V val, out V oldval)
Parameters
Type | Name | Description |
---|---|---|
K | key | The key to look for |
V | val | The value to add or replace with. |
V | oldval | The old value if any |
Returns
Type | Description |
---|---|
System.Boolean | True if key was found and value updated. |