ConcurrentDictionary<TKey, TValue>::AddOrUpdate Method
Adds a key/value pair to the ConcurrentDictionary<TKey, TValue> if the key does not already exist, or updates a key/value pair in the ConcurrentDictionary<TKey, TValue> if the key already exists.
Assembly: mscorlib (in mscorlib.dll)
| Name | Description | |
|---|---|---|
![]() | AddOrUpdate(TKey, TValue, Func<TKey, TValue, TValue>^) | Adds a key/value pair to the ConcurrentDictionary<TKey, TValue> if the key does not already exist, or updates a key/value pair in the ConcurrentDictionary<TKey, TValue> by using the specified function if the key already exists. |
![]() | AddOrUpdate(TKey, Func<TKey, TValue>^, Func<TKey, TValue, TValue>^) | Uses the specified functions to add a key/value pair to the ConcurrentDictionary<TKey, TValue> if the key does not already exist, or to update a key/value pair in the ConcurrentDictionary<TKey, TValue> if the key already exists. |
The following example shows how to call the AddOrUpdate method:
