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>::GetOrAdd Method

.NET Framework (current version)
 

Adds a key/value pair to the ConcurrentDictionary<TKey, TValue> if the key does not already exist.

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

NameDescription
System_CAPS_pubmethodGetOrAdd(TKey, TValue)

Adds a key/value pair to the ConcurrentDictionary<TKey, TValue> if the key does not already exist.

System_CAPS_pubmethodGetOrAdd(TKey, Func<TKey, TValue>^)

Adds a key/value pair to the ConcurrentDictionary<TKey, TValue> by using the specified function, if the key does not already exist.

The following example shows how to call the GetOrAdd method:

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