Export (0) Print
Expand All

CancellationTokenSource Class

Signals to a CancellationToken that it should be canceled.

System.Object
  System.Threading.CancellationTokenSource

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

[ComVisibleAttribute(false)]
public sealed class CancellationTokenSource : IDisposable

The CancellationTokenSource type exposes the following members.

  NameDescription
Public methodCancellationTokenSourceInitializes the CancellationTokenSource.
Top

  NameDescription
Public propertyIsCancellationRequestedGets whether cancellation has been requested for this CancellationTokenSource.
Public propertyTokenGets the CancellationToken associated with this CancellationTokenSource.
Top

  NameDescription
Public methodCancel()Communicates a request for cancellation.
Public methodCancel(Boolean)Communicates a request for cancellation.
Public methodStatic memberCreateLinkedTokenSource(CancellationToken[])Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.
Public methodStatic memberCreateLinkedTokenSource(CancellationToken, CancellationToken)Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.
Public methodDisposeReleases all resources used by the current instance of the CancellationTokenSource class.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

For more information and code examples see Cancellation.

Silverlight

Supported in: 5

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

All public and protected members of CancellationTokenRegistration are thread-safe and may be used concurrently from multiple threads, with the exception of Dispose, which must only be used when all other operations on the CancellationTokenRegistration have completed.

Community Additions

ADD
Show:
© 2014 Microsoft