<PackageReference Include="System.Reactive" Version="4.2.0-preview.566" />

CancellationDisposable

Represents a disposable resource that has an associated CancellationToken that will be set to the cancellation requested state upon disposal.
public bool IsDisposed { get; }

Gets a value that indicates whether the object is disposed.

public CancellationToken Token { get; }

Gets the CancellationToken used by this CancellationDisposable.

Initializes a new instance of the CancellationDisposable class that uses an existing CancellationTokenSource.

Initializes a new instance of the CancellationDisposable class that uses a new CancellationTokenSource.

public void Dispose()

Cancels the underlying CancellationTokenSource.