Partager via


ISettingsList.GetValueOrDefault<T>(String, T) Method

Definition

Returns the value corresponding to the given key. Returns defaultValue if the value is missing or not parsable as T.

template <typename T>
 T GetValueOrDefault(std::wstring const & key, T defaultValue = null);
public T GetValueOrDefault<T> (string key, T defaultValue = default);
abstract member GetValueOrDefault : string * 'T -> 'T
Public Function GetValueOrDefault(Of T) (key As String, Optional defaultValue As T = Nothing) As T

Type Parameters

T

The type of the value.

Parameters

key
String

The key.

defaultValue
T

The default value.

Returns

T

Returns Task.

Exceptions

Thrown when key is null.

Thrown when key is empty.

Remarks

This method is safe to access from any thread.

Applies to