CancellationTokenSource CancellationTokenSource CancellationTokenSource CancellationTokenSource Constructors

Definition

Overloads

CancellationTokenSource() CancellationTokenSource() CancellationTokenSource()

Initializes a new instance of the CancellationTokenSource class.

CancellationTokenSource(Int32) CancellationTokenSource(Int32) CancellationTokenSource(Int32) CancellationTokenSource(Int32)

Initializes a new instance of the CancellationTokenSource class that will be canceled after the specified delay in milliseconds.

CancellationTokenSource(TimeSpan) CancellationTokenSource(TimeSpan) CancellationTokenSource(TimeSpan) CancellationTokenSource(TimeSpan)

Initializes a new instance of the CancellationTokenSource class that will be canceled after the specified time span.

CancellationTokenSource() CancellationTokenSource() CancellationTokenSource()

Initializes a new instance of the CancellationTokenSource class.

public:
 CancellationTokenSource();
[System.Runtime.TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
public CancellationTokenSource ();
Public Sub New ()

CancellationTokenSource(Int32) CancellationTokenSource(Int32) CancellationTokenSource(Int32) CancellationTokenSource(Int32)

Initializes a new instance of the CancellationTokenSource class that will be canceled after the specified delay in milliseconds.

public:
 CancellationTokenSource(int millisecondsDelay);
public CancellationTokenSource (int millisecondsDelay);
new System.Threading.CancellationTokenSource : int -> System.Threading.CancellationTokenSource
Public Sub New (millisecondsDelay As Integer)
Parameters
millisecondsDelay
Int32 Int32 Int32 Int32

The time interval in milliseconds to wait before canceling this CancellationTokenSource.

Exceptions

Remarks

The countdown for the millisecondsDelay starts during the call to the constructor. When the millisecondsDelay expires, the constructed CancellationTokenSource is canceled (if it has not been canceled already).

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

CancellationTokenSource(TimeSpan) CancellationTokenSource(TimeSpan) CancellationTokenSource(TimeSpan) CancellationTokenSource(TimeSpan)

Initializes a new instance of the CancellationTokenSource class that will be canceled after the specified time span.

public:
 CancellationTokenSource(TimeSpan delay);
public CancellationTokenSource (TimeSpan delay);
new System.Threading.CancellationTokenSource : TimeSpan -> System.Threading.CancellationTokenSource
Public Sub New (delay As TimeSpan)
Parameters
delay
TimeSpan TimeSpan TimeSpan TimeSpan

The time interval to wait before canceling this CancellationTokenSource.

Exceptions

Remarks

The countdown for the delay starts during the call to the constructor. When the delay expires, the constructed CancellationTokenSource is canceled, if it has not been canceled already.

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

Applies to