Table of Contents

Class OptionsHelperExtensions

Namespace
Acuit.Pinpoint.Common.Options
Assembly
Acuit.Pinpoint.Common.dll

Helper extension members for IOptions<TOptions> and IOptionsMonitor<TOptions>.

public static class OptionsHelperExtensions
Inheritance
OptionsHelperExtensions
Inherited Members

Methods

TryGet<TOptions>(IOptionsMonitor<TOptions>, string?, out TOptions?, out Exception?)

Tries to get a configured TOptions instance with the given name.

public static bool TryGet<TOptions>(this IOptionsMonitor<TOptions> optionsMonitor, string? name, out TOptions? optionsValue, out Exception? error) where TOptions : class?

Parameters

optionsMonitor IOptionsMonitor<TOptions>
name string

The name of the TOptions instance. If null, DefaultName, which is the empty string, is used.

optionsValue TOptions

On return, the configured TOptions instance if successful; otherwise, null.

error Exception

On return, the exception representing the error if not successful; otherwise, null.

Returns

bool

true if successful; otherwise, false.

Type Parameters

TOptions

TryGet<TOptions>(IOptionsMonitor<TOptions>, out TOptions?, out Exception?)

Tries to get the current TOptions instance with the DefaultName.

public static bool TryGet<TOptions>(this IOptionsMonitor<TOptions> optionsMonitor, out TOptions? optionsValue, out Exception? error) where TOptions : class

Parameters

optionsMonitor IOptionsMonitor<TOptions>
optionsValue TOptions

On return, the configured TOptions instance if successful; otherwise, null.

error Exception

On return, the exception representing the error if not successful; otherwise, null.

Returns

bool

true if successful; otherwise, false.

Type Parameters

TOptions

TryGet<TOptions>(IOptions<TOptions>, out TOptions?, out Exception?)

Tries to get the default configured TOptions instance.

public static bool TryGet<TOptions>(this IOptions<TOptions> options, out TOptions? optionsValue, out Exception? error) where TOptions : class

Parameters

options IOptions<TOptions>
optionsValue TOptions

On return, the configured TOptions instance if successful; otherwise, null.

error Exception

On return, the exception representing the error if not successful; otherwise, null.

Returns

bool

true if successful; otherwise, false.

Type Parameters

TOptions