Class CancellationTokenFactory
Provides a CancellationTokenSource that will be re-instantiated after every cancellation.
public sealed class CancellationTokenFactory : IDisposable
- Inheritance
-
CancellationTokenFactory
- Implements
- Inherited Members
- Extension Methods
Properties
CurrentSource
The current CancellationTokenSource that provides the current non-cancelled CancellationToken. If the last stored CancellationTokenSource had a requested cancellation, a new one will be created.
public CancellationTokenSource CurrentSource { get; }
Property Value
CurrentToken
The current CancellationToken that is not yet cancelled.
public CancellationToken CurrentToken { get; }
Property Value
Methods
Cancel()
Cancels the current CancellationToken. This does not automatically trigger the instantiation of the new CancellationTokenSource.
public void Cancel()
Remarks
This cancels and disposes the currently stored CancellationTokenSource.
CreateSource()
Forces the creation of a new CancellationTokenSource.
public CancellationTokenSource CreateSource()
Returns
- CancellationTokenSource
The newly created CancellationTokenSource.
Remarks
This disposes the currently stored CancellationTokenSource (without cancelling it) and replaces it with a new instance.
Dispose()
Disposes the currently stored CancellationTokenSource without cancelling it.
public void Dispose()