AddOrUpdate Method
Definition
- Namespace
- Cuemon.Extensions.Collections.Generic
- Assemblies
- Cuemon.Extensions.Collections.Generic.dll
AddOrUpdate<TKey, TValue>(IDictionary<TKey, TValue>, TKey, TValue)
Attempts to add or update an existing element with the provided key to the dictionary with the specified value.
public static void AddOrUpdate<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue value)
Parameters
dictionaryIDictionary<TKey, TValue>The IDictionary<TKey, TValue> to extend.
keyTKeyThe key of the element to add or update.
valueTValueThe value of the element to add or update.
Type Parameters
TKeyTValue
Exceptions
- ArgumentNullException
dictionarycannot be null -or-keycannot be null.