Gets a value from the dictionary, returning the generated default value if it is missing.
public static TValue GetValueOrDefault<TKey, TValue>(
this IReadOnlyDictionary<TKey, TValue> dictionary, TKey key, Func<TValue> getDefaultValue)
parameter | description |
---|---|
TKey | The type of the key. |
TValue | The type of the value. |
dictionary | The dictionary. |
key | The key. |
getDefaultValue | The default value generator. |
The value, or a default value.