Class CancellationDisposable
Represents a disposable resource that has an associated CancellationToken that will be set to the cancellation requested state upon disposal.
Inherited Members
Namespace: System.Reactive.Disposables
Assembly: System.Reactive.Core.dll
Syntax
public sealed class CancellationDisposable : ICancelable, IDisposable
Constructors
| Improve this Doc View SourceCancellationDisposable()
Initializes a new instance of the CancellationDisposable class that uses a new CancellationTokenSource.
Declaration
public CancellationDisposable()
CancellationDisposable(CancellationTokenSource)
Initializes a new instance of the CancellationDisposable class that uses an existing CancellationTokenSource.
Declaration
public CancellationDisposable(CancellationTokenSource cts)
Parameters
Type | Name | Description |
---|---|---|
CancellationTokenSource | cts | CancellationTokenSource used for cancellation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Properties
| Improve this Doc View SourceIsDisposed
Gets a value that indicates whether the object is disposed.
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
Boolean |
Token
Gets the CancellationToken used by this CancellationDisposable.
Declaration
public CancellationToken Token { get; }
Property Value
Type | Description |
---|---|
CancellationToken |
Methods
| Improve this Doc View SourceDispose()
Cancels the underlying CancellationTokenSource.
Declaration
public void Dispose()