Прочитать на английском

Поделиться через


SettingValues.ValueOrDefault Method

Definition

Overloads

ValueOrDefault<T>(SettingIdentifier<T>, T)

Gets the value converted to the type T, if the retrieval and the conversion to T are successful. Returns defaultValue otherwise.

ValueOrDefault<T>(Setting+ObjectArray, T[])

Gets the value converted to the type T, if the retrieval and the conversion to T are successful. Returns defaultValue otherwise.

ValueOrDefault<T>(Setting<T>, T)

Gets the value converted to the type T, if the retrieval and the conversion to T are successful. Returns defaultValue otherwise.

ValueOrDefault<T>(SettingIdentifier<T>, T)

Gets the value converted to the type T, if the retrieval and the conversion to T are successful. Returns defaultValue otherwise.

public T ValueOrDefault<T>(Microsoft.VisualStudio.Extensibility.Settings.SettingIdentifier<T> settingId, T defaultValue);

Type Parameters

T

The expected type of the setting, only valid types for Setting<T> are supported.

Parameters

settingId
SettingIdentifier<T>

The full identifier of the setting, including the categories it is nested under.

defaultValue
T

The value to return in case of error reading the setting's value.

Returns

T

The value converted to the type T.

Exceptions

If T is not a supported type of Setting<T>.

Applies to

ValueOrDefault<T>(Setting+ObjectArray, T[])

Gets the value converted to the type T, if the retrieval and the conversion to T are successful. Returns defaultValue otherwise.

public T[] ValueOrDefault<T>(Microsoft.VisualStudio.Extensibility.Settings.Setting.ObjectArray setting, T[] defaultValue) where T : Microsoft.VisualStudio.Extensibility.Settings.IArraySettingItemConvertible, new();

Type Parameters

T

The expected type of the setting, only valid types for Setting<T> are supported.

Parameters

setting
Setting.ObjectArray

The setting for which the value is to be retrieved.

defaultValue
T[]

The value to return in case of error reading the setting's value.

Returns

T[]

The value converted to the type T.

Exceptions

If T is not a supported type of Setting<T>.

Applies to

ValueOrDefault<T>(Setting<T>, T)

Gets the value converted to the type T, if the retrieval and the conversion to T are successful. Returns defaultValue otherwise.

public T ValueOrDefault<T>(Microsoft.VisualStudio.Extensibility.Settings.Setting<T> setting, T defaultValue);

Type Parameters

T

The expected type of the setting, only valid types for Setting<T> are supported.

Parameters

setting
Setting<T>

The setting for which the value is to be retrieved.

defaultValue
T

The value to return in case of error reading the setting's value.

Returns

T

The value converted to the type T.

Exceptions

If T is not a supported type of Setting<T>.

Applies to