Table of Contents

Method GetValueOrDefault

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

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 TKey

The key of the value to get.

defaultValue TValue

Default 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 TKey

The key of the value to get.

func Func<TValue>

Default value provider function.

Returns

TValue