Class AdvDictionary<TKey, TValue>
Adds additional functionality to the Dictionary<TKey, TValue>.
public class AdvDictionary<TKey, TValue> : Dictionary<TKey, TValue>, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IEnumerable, IDeserializationCallback, ISerializable where TKey : notnull
Type Parameters
TKey
The type of the keys in the dictionary.
TValue
The type of the values in the dictionary.
- Inheritance
-
Dictionary<TKey, TValue>AdvDictionary<TKey, TValue>
- Implements
-
IDictionary<TKey, TValue>ICollection<KeyValuePair<TKey, TValue>>IReadOnlyDictionary<TKey, TValue>IReadOnlyCollection<KeyValuePair<TKey, TValue>>IEnumerable<KeyValuePair<TKey, TValue>>
- Derived
Methods
- GetOrCreate(TKey, Func<TValue>)
Gets the value associated with the specified key. If the
key
is not found in the dictionary, it is added there with the value provided byfunc
.
- GetValueOrDefault(TKey, Func<TValue>)
Gets the value associated with the specified
key
. Returns a result offunc
function call if thekey
is not found.
- GetValueOrDefault(TKey, TValue)
Gets the value associated with the specified key. Returns
defaultValue
if the key is not found.
- TryAdd(TKey, TValue)
Attempts to add the specified key and value to the dictionary.