CancellationTokenSource Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Signals to a CancellationToken that it should be canceled.
Inheritance Hierarchy
System.Object
System.Threading.CancellationTokenSource
Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<ComVisibleAttribute(False)> _
Public NotInheritable Class CancellationTokenSource _
Implements IDisposable
[ComVisibleAttribute(false)]
public sealed class CancellationTokenSource : IDisposable
The CancellationTokenSource type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
![]() |
IsCancellationRequested | Gets whether cancellation has been requested for this CancellationTokenSource. |
![]() |
Token | Gets the CancellationToken associated with this CancellationTokenSource. |
Top
Methods
| Name | Description | |
|---|---|---|
![]() |
Cancel() | Communicates a request for cancellation. |
![]() |
Cancel(Boolean) | Communicates a request for cancellation. |
![]() ![]() |
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. |
![]() |
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.) |
Top
Version Information
Silverlight
Supported in: 5
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
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.
.gif)
.gif)
.gif)
.gif)