CancellationTokenSource.CancelAfter CancellationTokenSource.CancelAfter CancellationTokenSource.CancelAfter CancellationTokenSource.CancelAfter Method

Definition

Schedules a cancel operation on this CancellationTokenSource.

Overloads

CancelAfter(Int32) CancelAfter(Int32) CancelAfter(Int32) CancelAfter(Int32)

Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds.

CancelAfter(TimeSpan) CancelAfter(TimeSpan) CancelAfter(TimeSpan) CancelAfter(TimeSpan)

Schedules a cancel operation on this CancellationTokenSource after the specified time span.

CancelAfter(Int32) CancelAfter(Int32) CancelAfter(Int32) CancelAfter(Int32)

Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds.

public:
 void CancelAfter(int millisecondsDelay);
public void CancelAfter (int millisecondsDelay);
member this.CancelAfter : int -> unit
Public Sub CancelAfter (millisecondsDelay As Integer)

Parameters

millisecondsDelay
Int32 Int32 Int32 Int32

The time span to wait before canceling this CancellationTokenSource.

Exceptions

Remarks

The countdown for the millisecondsDelay starts during this call. When the millisecondsDelay expires, this CancellationTokenSource is canceled, if it has not been canceled already.

Subsequent calls to CancelAfter will reset the millisecondsDelay for this CancellationTokenSource, if it has not been canceled already.

CancelAfter(TimeSpan) CancelAfter(TimeSpan) CancelAfter(TimeSpan) CancelAfter(TimeSpan)

Schedules a cancel operation on this CancellationTokenSource after the specified time span.

public:
 void CancelAfter(TimeSpan delay);
public void CancelAfter (TimeSpan delay);
member this.CancelAfter : TimeSpan -> unit
Public Sub CancelAfter (delay As TimeSpan)

Parameters

delay
TimeSpan TimeSpan TimeSpan TimeSpan

The time span to wait before canceling this CancellationTokenSource.

Exceptions

The exception that is thrown when delay is less than -1 or greater than Int32.MaxValue.

Applies to