ISettingsStorageHelperExtensions.GetValueOrDefault<TKey,TValue> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to read the provided key and return the value. If the key is not found, the fallback value will be used instead.
public static TValue? GetValueOrDefault<TKey,TValue> (this Microsoft.Toolkit.Helpers.ISettingsStorageHelper<TKey> storageHelper, TKey key, TValue? fallback = default);
static member GetValueOrDefault : Microsoft.Toolkit.Helpers.ISettingsStorageHelper<'Key> * 'Key * 'Value -> 'Value
<Extension()>
Public Function GetValueOrDefault(Of TKey, TValue) (storageHelper As ISettingsStorageHelper(Of TKey), key As TKey, Optional fallback As TValue = Nothing) As TValue
Type Parameters
- TKey
The type of key used to lookup the object.
- TValue
The type of object value expected.
Parameters
- storageHelper
- ISettingsStorageHelper<TKey>
The storage helper instance fo read from.
- key
- TKey
The key of the target object.
- fallback
- TValue
An alternative value returned if the read fails.
Returns
TValue
The value of the target object, or the fallback value.