Share via


WorkspaceSettingsExtensions.Property<T> Method

Definition

Wrapper around WorkspaceSettingsResult GetProperty. Used when caller is not interested by the current state, but just want to get the current value to use.

public static T Property<T> (this Microsoft.VisualStudio.Workspace.Settings.IWorkspaceSettingsSource settings, string key, T defaultValue = default);
public static T Property<T> (this Microsoft.VisualStudio.Workspace.Settings.IWorkspaceSettingsSource settings, string key, T? defaultValue = default);
static member Property : Microsoft.VisualStudio.Workspace.Settings.IWorkspaceSettingsSource * string * 'T -> 'T
<Extension()>
Public Function Property(Of T) (settings As IWorkspaceSettingsSource, key As String, Optional defaultValue As T = Nothing) As T

Type Parameters

T

type of the value

Parameters

settings
IWorkspaceSettingsSource

the settings instance

key
String

the name of the property

defaultValue
T

optional default value to use if the current value is not present or corrupted

Returns

T

the current value as persisted in the settings or default

Applies to