Method GetValueOrDefault
GetValueOrDefault(TKey, TValue)
Gets the value associated with the specified key.
Returns defaultValue
if the key is not found.
public TValue GetValueOrDefault(TKey key, TValue defaultValue = default)
Parameters
key
TKeyThe key of the value to get.
defaultValue
TValueDefault value.
Returns
- TValue
GetValueOrDefault(TKey, Func<TValue>)
Gets the value associated with the specified key
.
Returns a result of func
function call
if the key
is not found.
public TValue GetValueOrDefault(TKey key, Func<TValue> func)
Parameters
key
TKeyThe key of the value to get.
func
Func<TValue>Default value provider function.
Returns
- TValue