Cancellation

Cancellation class

Represents an object for requesting cancellation of an operation.

public class Cancellation : IDisposable

Constructors

Name Description
Cancellation() Initializes a new instance of the Cancellation class.

Properties

Name Description
IsCancelled { get; } Gets a value indicating that cancellation has been requested.

Methods

Name Description
Cancel() Makes a request for cancellation.
CancelAfter(int) Makes a request for cancellation after the expiration of the specified number of milliseconds.
Dispose() Releases the timer of a cancellation scheduled by CancelAfter: the scheduled cancellation is not requested. A cancellation that is requested already stays requested, and Cancel requests the cancellation after the call as well.

Remarks

A cancellation scheduled by CancelAfter keeps a timer until it is requested. Dispose releases the timer, so the scheduled cancellation is not requested.

Learn more

See Also