Class XDictionary
- Namespace
- Prefrontal.Common.Extensions
- Assembly
- Prefrontal.Core.dll
Provides extension methods for IDictionary<TKey, TValue>.
public static class XDictionary
- Inheritance
-
XDictionary
- Inherited Members
Methods
GetOrAdd<TKey, TValue>(IDictionary<TKey, TValue>, TKey)
Gets the value associated with the specified key or adds a new value if the key is not found.
public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) where TValue : new()
Parameters
dictionaryIDictionary<TKey, TValue>keyTKey
Returns
- TValue
The value associated with the specified key or the new value.
Type Parameters
TKeyThe type of the keys in the dictionary.
TValueThe type of the values in the dictionary.
GetOrAdd<TKey, TValue>(IDictionary<TKey, TValue>, TKey, Func<TValue>)
Gets the value associated with the specified key or adds a new value if the key is not found.
public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TValue> valueFactory)
Parameters
dictionaryIDictionary<TKey, TValue>keyTKeyvalueFactoryFunc<TValue>The function used to generate a new value in case the key is not found.
Returns
- TValue
The value associated with the specified key or the new value.
Type Parameters
TKeyThe type of the keys in the dictionary.
TValueThe type of the values in the dictionary.