Method AddOrUpdate
AddOrUpdate(TKey, TValue, KeyValueUpdate<TKey, TValue>)
Adds a key/value pair to the System.Collections.Generic.IDictionary<TKey, TValue> if the key does not already exist,
or updates a key/value pair if the key already exists.
Declaration
public TValue AddOrUpdate(TKey key, TValue addValue, KeyValueUpdate<TKey, TValue> fnUpdate)
Parameters
Type |
Name |
Description |
TKey |
key |
|
TValue |
addValue |
|
KeyValueUpdate<TKey, TValue> |
fnUpdate |
|
Returns
AddOrUpdate(TKey, Func<TKey, TValue>, KeyValueUpdate<TKey, TValue>)
Adds a key/value pair to the System.Collections.Generic.IDictionary<TKey, TValue> if the key does not already exist,
or updates a key/value pair if the key already exists.
Declaration
public TValue AddOrUpdate(TKey key, Func<TKey, TValue> fnCreate, KeyValueUpdate<TKey, TValue> fnUpdate)
Parameters
Type |
Name |
Description |
TKey |
key |
|
Func<TKey, TValue> |
fnCreate |
|
KeyValueUpdate<TKey, TValue> |
fnUpdate |
|
Returns
AddOrUpdate<T>(TKey, ref T)
Add, update, or fetche a key/value pair from the dictionary via an implementation of the
CSharpTest.Net.Collections.ICreateOrUpdateValue`2 interface.
Declaration
public bool AddOrUpdate<T>(TKey key, ref T createOrUpdateValue)
where T : ICreateOrUpdateValue<TKey, TValue>
Parameters
Type |
Name |
Description |
TKey |
key |
|
T |
createOrUpdateValue |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters