ChangeToken.OnChange Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| OnChange(Func<IChangeToken>, Action) |
Registers the |
| OnChange(Func<IChangeToken>, Func<Task>) |
Registers the |
| OnChange<TState>(Func<IChangeToken>, Action<TState>, TState) |
Registers the |
| OnChange<TState>(Func<IChangeToken>, Func<TState,Task>, TState) |
Registers the |
OnChange(Func<IChangeToken>, Action)
- Source:
- ChangeToken.cs
- Source:
- ChangeToken.cs
- Source:
- ChangeToken.cs
- Source:
- ChangeToken.cs
Registers the changeTokenConsumer action to be called whenever the token produced changes.
public:
static IDisposable ^ OnChange(Func<Microsoft::Extensions::Primitives::IChangeToken ^> ^ changeTokenProducer, Action ^ changeTokenConsumer);
public static IDisposable OnChange(Func<Microsoft.Extensions.Primitives.IChangeToken?> changeTokenProducer, Action changeTokenConsumer);
static member OnChange : Func<Microsoft.Extensions.Primitives.IChangeToken> * Action -> IDisposable
Public Shared Function OnChange (changeTokenProducer As Func(Of IChangeToken), changeTokenConsumer As Action) As IDisposable
Parameters
- changeTokenProducer
- Func<IChangeToken>
Produces the change token.
- changeTokenConsumer
- Action
Action called when the token changes. The token is re-registered once the action returns.
Returns
An IDisposable that, when disposed, unregisters the consumer.
Remarks
Exceptions from changeTokenProducer are propagated to the caller of this method or to the code that triggers the change token. Exceptions from changeTokenConsumer are propagated to the code that triggers the change token.
Applies to
OnChange(Func<IChangeToken>, Func<Task>)
- Source:
- ChangeToken.cs
Registers the changeTokenConsumer function to be called whenever the token produced changes.
public:
static IDisposable ^ OnChange(Func<Microsoft::Extensions::Primitives::IChangeToken ^> ^ changeTokenProducer, Func<System::Threading::Tasks::Task ^> ^ changeTokenConsumer);
public static IDisposable OnChange(Func<Microsoft.Extensions.Primitives.IChangeToken?> changeTokenProducer, Func<System.Threading.Tasks.Task> changeTokenConsumer);
static member OnChange : Func<Microsoft.Extensions.Primitives.IChangeToken> * Func<System.Threading.Tasks.Task> -> IDisposable
Public Shared Function OnChange (changeTokenProducer As Func(Of IChangeToken), changeTokenConsumer As Func(Of Task)) As IDisposable
Parameters
- changeTokenProducer
- Func<IChangeToken>
Produces the change token.
Function called when the token changes. The token is only re-registered once the returned Task completes.
Returns
An IDisposable that, when disposed, unregisters the consumer.
Remarks
Exceptions from changeTokenProducer are propagated to the caller of this method or to the code that triggers the change token. Synchronous exceptions from changeTokenConsumer are propagated to the code that triggers the change token. Asynchronous exceptions from changeTokenConsumer are left unobserved.
Applies to
OnChange<TState>(Func<IChangeToken>, Action<TState>, TState)
- Source:
- ChangeToken.cs
- Source:
- ChangeToken.cs
- Source:
- ChangeToken.cs
- Source:
- ChangeToken.cs
Registers the changeTokenConsumer action to be called whenever the token produced changes.
public:
generic <typename TState>
static IDisposable ^ OnChange(Func<Microsoft::Extensions::Primitives::IChangeToken ^> ^ changeTokenProducer, Action<TState> ^ changeTokenConsumer, TState state);
public static IDisposable OnChange<TState>(Func<Microsoft.Extensions.Primitives.IChangeToken?> changeTokenProducer, Action<TState> changeTokenConsumer, TState state);
static member OnChange : Func<Microsoft.Extensions.Primitives.IChangeToken> * Action<'State> * 'State -> IDisposable
Public Shared Function OnChange(Of TState) (changeTokenProducer As Func(Of IChangeToken), changeTokenConsumer As Action(Of TState), state As TState) As IDisposable
Type Parameters
- TState
The type of the state for the changeTokenConsumer action.
Parameters
- changeTokenProducer
- Func<IChangeToken>
Produces the change token.
- changeTokenConsumer
- Action<TState>
Action called when the token changes. The token is re-registered once the action returns.
- state
- TState
state for the consumer.
Returns
An IDisposable that, when disposed, unregisters the consumer.
Remarks
Exceptions from changeTokenProducer are propagated to the caller of this method or to the code that triggers the change token. Exceptions from changeTokenConsumer are propagated to the code that triggers the change token.
Applies to
OnChange<TState>(Func<IChangeToken>, Func<TState,Task>, TState)
- Source:
- ChangeToken.cs
Registers the changeTokenConsumer function to be called whenever the token produced changes.
public:
generic <typename TState>
static IDisposable ^ OnChange(Func<Microsoft::Extensions::Primitives::IChangeToken ^> ^ changeTokenProducer, Func<TState, System::Threading::Tasks::Task ^> ^ changeTokenConsumer, TState state);
public static IDisposable OnChange<TState>(Func<Microsoft.Extensions.Primitives.IChangeToken?> changeTokenProducer, Func<TState,System.Threading.Tasks.Task> changeTokenConsumer, TState state);
static member OnChange : Func<Microsoft.Extensions.Primitives.IChangeToken> * Func<'State, System.Threading.Tasks.Task> * 'State -> IDisposable
Public Shared Function OnChange(Of TState) (changeTokenProducer As Func(Of IChangeToken), changeTokenConsumer As Func(Of TState, Task), state As TState) As IDisposable
Type Parameters
- TState
Parameters
- changeTokenProducer
- Func<IChangeToken>
Produces the change token.
Function called when the token changes. The token is only re-registered once the returned Task completes.
- state
- TState
state for the consumer.
Returns
An IDisposable that, when disposed, unregisters the consumer.
Remarks
Exceptions from changeTokenProducer are propagated to the caller of this method or to the code that triggers the change token. Synchronous exceptions from changeTokenConsumer are propagated to the code that triggers the change token. Asynchronous exceptions from changeTokenConsumer are left unobserved.