Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ConcurrentDictionary<TKey, TValue>::AddOrUpdate Method

.NET Framework (current version)
 

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.

Namespace:   System.Collections.Concurrent
Assembly:  mscorlib (in mscorlib.dll)

NameDescription
System_CAPS_pubmethodAddOrUpdate(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.

System_CAPS_pubmethodAddOrUpdate(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:

No code example is currently available or this language may not be supported.
Return to top
Show:
© 2017 Microsoft