[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Signals to a CancellationToken that it should be canceled.
Assembly: mscorlib (in mscorlib.dll)
Public Class CancellationTokenSource _ Implements IDisposable
public class CancellationTokenSource : IDisposable
The CancellationTokenSource type exposes the following members.
|CancellationTokenSource()()()||Initializes the CancellationTokenSource.|
|CancellationTokenSource(Int32)||Constructs a CancellationTokenSource that will be canceled after a specified time span.|
|CancellationTokenSource(TimeSpan)||Constructs a CancellationTokenSource that will be canceled after a specified time span.|
|IsCancellationRequested||Gets whether cancellation has been requested for this CancellationTokenSource.|
|Token||Gets the CancellationToken associated with this CancellationTokenSource.|
|Cancel()()()||Communicates a request for cancellation.|
|Cancel(Boolean)||Communicates a request for cancellation.|
|CancelAfter(Int32)||Schedules a Cancel operation on this CancellationTokenSource.|
|CancelAfter(TimeSpan)||Schedules a Cancel operation on this CancellationTokenSource.|
|CreateLinkedTokenSource(array<CancellationToken>())||Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.|
|CreateLinkedTokenSource(CancellationToken, CancellationToken)||Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.|
|Dispose()()()||Releases all resources used by the current instance of the CancellationTokenSource class.|
|Dispose(Boolean)||Releases the unmanaged resources used by the CancellationTokenSource class and optionally releases the managed resources.|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
For more information and code examples see [eea11fe5-d8b0-4314-bb5d-8a58166fb1c3].
Windows Phone OS
Supported in: 8.1, 8.0
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.