Share via


OptionsMonitor<TOptions> Class

Definition

generic <typename TOptions>
 where TOptions : classpublic ref class OptionsMonitor : IDisposable, Microsoft::Extensions::Options::IOptionsMonitor<TOptions>
public class OptionsMonitor<TOptions> : IDisposable, Microsoft.Extensions.Options.IOptionsMonitor<TOptions> where TOptions : class
type OptionsMonitor<'Options (requires 'Options : null)> = class
    interface IOptionsMonitor<'Options (requires 'Options : null)>
    interface IDisposable
Public Class OptionsMonitor(Of TOptions)
Implements IDisposable, IOptionsMonitor(Of TOptions)

Type Parameters

TOptions

The options type.

Inheritance
OptionsMonitor<TOptions>
Implements

Constructors

Name Description
OptionsMonitor<TOptions>(IOptionsFactory<TOptions>, IEnumerable<IOptionsChangeTokenSource<TOptions>>, IOptionsMonitorCache<TOptions>)

Initializes a new instance of OptionsMonitor<TOptions> with the specified factory, sources, and cache.

Properties

Name Description
CurrentValue

Gets the present value of the options (equivalent to Get(Options.DefaultName)).

Methods

Name Description
Dispose()

Removes all change registration subscriptions.

Get(String)

Returns a configured TOptions instance with the given name.

OnChange(Action<TOptions,String>)

Registers a listener to be called whenever TOptions changes.

Extension Methods

Name Description
OnChange<TOptions>(IOptionsMonitor<TOptions>, Action<TOptions>)

Registers a listener to be called whenever TOptions changes.

Applies to