Share via


IPreferences.Get<T>(String, T, String) Method

Definition

Gets the value for a given key, or the default specified if the key does not exist.

public T Get<T> (string key, T defaultValue, string? sharedName = default);
abstract member Get : string * 'T * string -> 'T
Public Function Get(Of T) (key As String, defaultValue As T, Optional sharedName As String = Nothing) As T

Type Parameters

T

The type of the object stored for this preference.

Parameters

key
String

The key to retrieve the value for.

defaultValue
T

The default value to return when no existing value for key exists.

sharedName
String

Shared container name.

Returns

T

Value for the given key, or the value in defaultValue if it does not exist.

Applies to