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
dictionary
IDictionary<TKey, TValue>key
TKey
Returns
- TValue
The value associated with the specified key or the new value.
Type Parameters
TKey
The type of the keys in the dictionary.
TValue
The 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
dictionary
IDictionary<TKey, TValue>key
TKeyvalueFactory
Func<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
TKey
The type of the keys in the dictionary.
TValue
The type of the values in the dictionary.