Class DictionaryExtensions
Provides extension methods for dictionaries.
Inherited Members
Namespace: DevToys.Api
Assembly: DevToys.Api.dll
Syntax
public static class DictionaryExtensions
Methods
GetValueOrDefault<TKey, TValue>(IDictionary<TKey, TValue>, TKey)
Gets the value at the given key, or a default value.
Declaration
public static TValue? GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<TKey, TValue> | dictionary | The dictionary to retrieve the value from. |
TKey | key | The key to retrieve the value for. |
Returns
Type | Description |
---|---|
TValue | The value associated with the specified key, or the default value if the key is not found. |
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in the dictionary. |
TValue | The type of the values in the dictionary. |