class CancellationTokenSource

in global :: System . Threading

Signals to a that it should be canceled.


public CancellationTokenSource( int millisecondsDelay )

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

  • millisecondsDelay The time interval in milliseconds to wait before canceling this .

public CancellationTokenSource( TimeSpan delay )

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

  • delay The time interval to wait before canceling this .

public void Cancel( bool throwOnFirstException )

Communicates a request for cancellation, and specifies whether remaining callbacks and cancelable operations should be processed if an exception occurs.

  • throwOnFirstException if exceptions should immediately propagate; otherwise, .

public void CancelAfter( int millisecondsDelay )

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

  • millisecondsDelay The time span to wait before canceling this .

public void CancelAfter( TimeSpan delay )

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

  • delay The time span to wait before canceling this .

public static CancellationTokenSource CreateLinkedTokenSource( CancellationToken token1, CancellationToken token2 )

Creates a that will be in the canceled state when any of the source tokens are in the canceled state.

  • token1 The first cancellation token to observe.
  • token2 The second cancellation token to observe.
  • Returns A that is linked to the source tokens.

public static CancellationTokenSource CreateLinkedTokenSource( CancellationToken[] tokens )

Creates a that will be in the canceled state when any of the source tokens in the specified array are in the canceled state.

  • tokens An array that contains the cancellation token instances to observe.
  • Returns A that is linked to the source tokens.

public bool IsCancellationRequested { get; }

Gets whether cancellation has been requested for this .

  • Returns if cancellation has been requested for this ; otherwise, .

public CancellationToken Token { get; }

Gets the associated with this .

  • Returns The associated with this .

public void Dispose( )

😔 No documentation found.

public Task CancelAsync( )

😔 No documentation found.

public CancellationTokenSource( TimeSpan delay, TimeProvider timeProvider )

😔 No documentation found.

public void Cancel( )

😔 No documentation found.

public static CancellationTokenSource CreateLinkedTokenSource( ReadOnlySpan<CancellationToken> tokens )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public bool Equals( object obj )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public CancellationTokenSource( )

😔 No documentation found.

public bool TryReset( )

😔 No documentation found.

public static CancellationTokenSource CreateLinkedTokenSource( CancellationToken token )

😔 No documentation found.