Extension methods for Dictionary{K,V}, IDictionary{K,V} and IDictionaryEx{K, V}.
More...
Extension methods for Dictionary{K,V}, IDictionary{K,V} and IDictionaryEx{K, V}.
|
| static IDictionarySink< K, V > | AsSink< K, V > (this IDictionary< K, V > dict) |
| | Adapts a dictionary to the IDictionarySink{K, V} interface. More...
|
| |
| static V | GetOrAdd< K, V > (this IDictionary< K, V > dict, K key, V value) |
| | Adds a key/value pair to the dictionary if the key is not already present, and returns the existing or new value. More...
|
| |
| static V | GetOrAdd< K, V > (this IDictionary< K, V > dict, K key, Func< K, V > valueFactory) |
| | Adds a key/value pair to the dictionary if the key is not already present, by using the specified function to obtain a value, and returns the existing or new value. More...
|
| |
| static V | GetOrAdd< K, V > (this Dictionary< K, V > dict, K key, V value) |
| |
| static V | GetOrAdd< K, V > (this Dictionary< K, V > dict, K key, Func< K, V > valueFactory) |
| |
| static V | AddOrUpdate< K, V > (this IDictionary< K, V > dict, K key, Func< K, V > addValueFactory, Func< K, V, V > updateValueFactory) |
| | Uses the specified functions either to add a key/value pair to the dictionary if the key does not already exist, or to update a key/value pair in the dictionary if the key already exists. More...
|
| |
| static V | AddOrUpdate< K, V > (this IDictionary< K, V > dict, K key, V addValue, Func< K, V, V > updateValueFactory) |
| | Adds a key/value pair to the dictionary if the key does not already exist, or, if it does, updates a key/value pair in the dictionary using the specified function. More...
|
| |
| static V | AddOrUpdate< K, V > (this Dictionary< K, V > dict, K key, Func< K, V > addValueFactory, Func< K, V, V > updateValueFactory) |
| |
| static V | AddOrUpdate< K, V > (this Dictionary< K, V > dict, K key, V addValue, Func< K, V, V > updateValueFactory) |
| |
| static V | TryGetValue< K, V > (this Dictionary< K, V > dict, K key, V defaultValue) |
| | An alternate version TryGetValue that returns a default value if the key was not found in the dictionary, and that does not throw if the key is null. More...
|
| |
|
static V | TryGetValue< K, V > (this IDictionary< K, V > dict, K key, V defaultValue) |
| |
|
static V | TryGetValue< K, V > (this IReadOnlyDictionary< K, V > dict, K key, V defaultValue) |
| |
| static V | TryGetValue< K, V > (this IDictionaryAndReadOnly< K, V > dict, K key, V defaultValue) |
| | Disambiguating overload. More...
|
| |
| static Maybe< V > | TryGetValue< K, V > (this IDictionary< K, V > dict, K key) |
| | Same as IDictionary.TryGetValue() except that this method does not throw an exception when key==null (it simply returns NoValue), and it returns the result as Maybe{V} instead of storing the result in an "out" parameter. More...
|
| |
|
static Maybe< V > | TryGetValue< K, V > (this IReadOnlyDictionary< K, V > dict, K key) |
| |
|
static Maybe< V > | TryGetValue< K, V > (this IDictionaryAndReadOnly< K, V > dict, K key) |
| |
|
static Maybe< V > | TryGetValue< K, V > (this Dictionary< K, V > dict, K key) |
| |
| static bool | TryGetValueSafe< K, V > (this IDictionary< K, V > dict, K key, [MaybeNullWhen(false)] out V value) |
| | Same as IDictionary.TryGetValue() except that this method does not throw an exception when key==null (it simply returns false). More...
|
| |
| static int | AddRange< K, V > (this IDictionary< K, V > dict, IEnumerable< KeyValuePair< K, V >> list) |
| | Adds data to a dictionary (dict.Add(key, value) for all pairs in a sequence.) More...
|
| |
| static void | SetRange< K, V > (this IDictionary< K, V > dict, IEnumerable< KeyValuePair< K, V >> list) |
| | Adds data to a dictionary (dict[key] = value for all pairs in a sequence.) More...
|
| |
| static int | RemoveRange< K, V > (this IDictionary< K, V > dict, IEnumerable< K > list) |
| | Tries to remove a set of key-values from a dictionary based on their keys. More...
|
| |
| static int | AddRange< K, V > (this IDictionary< K, V > dict, IEnumerable< KeyValuePair< K, V >> data, DictEditMode mode) |
| | Default implementation of IDictionaryEx{K, V}.AddRange. Merges the contents of the specified sequence into this map. More...
|
| |
| static Maybe< V > | GetAndRemove< K, V > (this IDictionary< K, V > dict, K key) |
| | Default implementation of IDictionaryEx{K, V}.GetAndRemove. Gets the value associated with the specified key, then removes the pair with that key from the dictionary. More...
|
| |
| static Maybe< V > | GetAndRemove< K, V > (this Dictionary< K, V > dict, K key) |
| |