Class DictionaryExtensions
- Namespace
- LfrlAnvil.Functional.Extensions
- Assembly
- LfrlAnvil.Functional.dll
Contains dictionary extension methods.
public static class DictionaryExtensions
- Inheritance
-
DictionaryExtensions
- Inherited Members
Methods
TryGetValue<TKey, TValue>(IReadOnlyDictionary<TKey, TValue>, TKey)
Attempts to get a value associated with the provided key from the dictionary.
[Pure]
public static Maybe<TValue> TryGetValue<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key) where TValue : notnull
Parameters
dictionaryIReadOnlyDictionary<TKey, TValue>Source dictionary.
keyTKeyEntry's key.
Returns
- Maybe<TValue>
New Maybe<T> instance equivalent to value associated with the provided
keyor None when it does not exist.
Type Parameters
TKeyKey type.
TValueValue type.
TryRemove<TKey, TValue>(Dictionary<TKey, TValue>, TKey)
Attempts to get remove an entry associated with the provided key from the dictionary.
[Pure]
public static Maybe<TValue> TryRemove<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TKey key) where TKey : notnull where TValue : notnull
Parameters
dictionaryDictionary<TKey, TValue>Source dictionary.
keyTKeyEntry's key.
Returns
- Maybe<TValue>
New Maybe<T> instance equivalent to removed value associated with the provided
keyor None when it does not exist.
Type Parameters
TKeyKey type.
TValueValue type.