Class OptionsHelperExtensions
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
optionsMonitorIOptionsMonitor<TOptions>namestringThe name of the
TOptionsinstance. If null, DefaultName, which is the empty string, is used.optionsValueTOptionsOn return, the configured
TOptionsinstance if successful; otherwise, null.errorExceptionOn return, the exception representing the error if not successful; otherwise, null.
Returns
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
optionsMonitorIOptionsMonitor<TOptions>optionsValueTOptionsOn return, the configured
TOptionsinstance if successful; otherwise, null.errorExceptionOn return, the exception representing the error if not successful; otherwise, null.
Returns
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
optionsIOptions<TOptions>optionsValueTOptionsOn return, the configured
TOptionsinstance if successful; otherwise, null.errorExceptionOn return, the exception representing the error if not successful; otherwise, null.
Returns
Type Parameters
TOptions