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: