Propagates notification that operations should be canceled.
More...
Propagates notification that operations should be canceled.
Definition at line 14 of file CancellationToken.cs.
◆ CancellationToken()
System.Threading.CancellationToken.CancellationToken |
( |
bool |
canceled | ) |
|
Initializes the T:System.Threading.CancellationToken.
- Parameters
-
canceled | The canceled state for the token. |
Definition at line 91 of file CancellationToken.cs.
◆ Equals() [1/2]
Determines whether the current T:System.Threading.CancellationToken instance is equal to the specified token.
- Parameters
-
other | The other T:System.Threading.CancellationToken to which to compare this instance. |
- Returns
true
if the instances are equal; otherwise, false
. Two tokens are equal if they are associated with the same T:System.Threading.CancellationTokenSource or if they were both constructed from public T:System.Threading.CancellationToken constructors and their P:System.Threading.CancellationToken.IsCancellationRequested values are equal.
Definition at line 209 of file CancellationToken.cs.
◆ Equals() [2/2]
override bool System.Threading.CancellationToken.Equals |
( |
object |
other | ) |
|
Determines whether the current T:System.Threading.CancellationToken instance is equal to the specified T:System.Object.
- Parameters
-
other | The other object to which to compare this instance. |
- Returns
true
if other is a T:System.Threading.CancellationToken and if the two instances are equal; otherwise, false
. Two tokens are equal if they are associated with the same T:System.Threading.CancellationTokenSource or if they were both constructed from public T:System.Threading.CancellationToken constructors and their P:System.Threading.CancellationToken.IsCancellationRequested values are equal.
- Exceptions
-
T:System.ObjectDisposedException | An associated T:System.Threading.CancellationTokenSource has been disposed. |
Definition at line 232 of file CancellationToken.cs.
◆ GetHashCode()
override int System.Threading.CancellationToken.GetHashCode |
( |
| ) |
|
Serves as a hash function for a T:System.Threading.CancellationToken.
- Returns
- A hash code for the current T:System.Threading.CancellationToken instance.
Definition at line 244 of file CancellationToken.cs.
◆ operator !=()
Determines whether two T:System.Threading.CancellationToken instances are not equal.
- Parameters
-
left | The first instance. |
right | The second instance. |
- Returns
true
if the instances are not equal; otherwise, false
.
- Exceptions
-
T:System.ObjectDisposedException | An associated T:System.Threading.CancellationTokenSource has been disposed. |
Definition at line 272 of file CancellationToken.cs.
◆ operator==()
Determines whether two T:System.Threading.CancellationToken instances are equal.
- Parameters
-
left | The first instance. |
right | The second instance. |
- Returns
true
if the instances are equal; otherwise, false
.
- Exceptions
-
T:System.ObjectDisposedException | An associated T:System.Threading.CancellationTokenSource has been disposed. |
Definition at line 260 of file CancellationToken.cs.
◆ Register() [1/4]
Registers a delegate that will be called when this T:System.Threading.CancellationToken is canceled.
- Parameters
-
callback | The delegate to be executed when the T:System.Threading.CancellationToken is canceled. |
- Returns
- The T:System.Threading.CancellationTokenRegistration instance that can be used to deregister the callback.
- Exceptions
-
T:System.ObjectDisposedException | The associated T:System.Threading.CancellationTokenSource has been disposed. |
T:System.ArgumentNullException | callback is null. |
Definition at line 113 of file CancellationToken.cs.
◆ Register() [2/4]
Registers a delegate that will be called when this T:System.Threading.CancellationToken is canceled.
- Parameters
-
callback | The delegate to be executed when the T:System.Threading.CancellationToken is canceled. |
useSynchronizationContext | A value that indicates whether to capture the current T:System.Threading.SynchronizationContext and use it when invoking the callback . |
- Returns
- The T:System.Threading.CancellationTokenRegistration instance that can be used to deregister the callback.
- Exceptions
-
T:System.ObjectDisposedException | The associated T:System.Threading.CancellationTokenSource has been disposed. |
T:System.ArgumentNullException | callback is null. |
Definition at line 130 of file CancellationToken.cs.
◆ Register() [3/4]
Registers a delegate that will be called when this T:System.Threading.CancellationToken is canceled.
- Parameters
-
callback | The delegate to be executed when the T:System.Threading.CancellationToken is canceled. |
state | The state to pass to the callback when the delegate is invoked. This may be null. |
- Returns
- The T:System.Threading.CancellationTokenRegistration instance that can be used to deregister the callback.
- Exceptions
-
T:System.ObjectDisposedException | The associated T:System.Threading.CancellationTokenSource has been disposed. |
T:System.ArgumentNullException | callback is null. |
Definition at line 147 of file CancellationToken.cs.
◆ Register() [4/4]
Registers a delegate that will be called when this T:System.Threading.CancellationToken is canceled.
- Parameters
-
callback | The delegate to be executed when the T:System.Threading.CancellationToken is canceled. |
state | The state to pass to the callback when the delegate is invoked. This may be null. |
useSynchronizationContext | A Boolean value that indicates whether to capture the current T:System.Threading.SynchronizationContext and use it when invoking the callback . |
- Returns
- The T:System.Threading.CancellationTokenRegistration instance that can be used to deregister the callback.
- Exceptions
-
T:System.ObjectDisposedException | The associated T:System.Threading.CancellationTokenSource has been disposed. |
T:System.ArgumentNullException | callback is null. |
Definition at line 165 of file CancellationToken.cs.
◆ ThrowIfCancellationRequested()
void System.Threading.CancellationToken.ThrowIfCancellationRequested |
( |
| ) |
|
Throws a T:System.OperationCanceledException if this token has had cancellation requested.
- Exceptions
-
T:System.OperationCanceledException | The token has had cancellation requested. |
T:System.ObjectDisposedException | The associated T:System.Threading.CancellationTokenSource has been disposed. |
Definition at line 281 of file CancellationToken.cs.
◆ CanBeCanceled
bool System.Threading.CancellationToken.CanBeCanceled |
|
get |
Gets whether this token is capable of being in the canceled state.
- Returns
true
if this token is capable of being in the canceled state; otherwise, false
.
Definition at line 54 of file CancellationToken.cs.
◆ IsCancellationRequested
bool System.Threading.CancellationToken.IsCancellationRequested |
|
get |
Gets whether cancellation has been requested for this token.
- Returns
true
if cancellation has been requested for this token; otherwise, false
.
Definition at line 37 of file CancellationToken.cs.
◆ None
Returns an empty T:System.Threading.CancellationToken value.
- Returns
- An empty cancellation token.
Definition at line 24 of file CancellationToken.cs.
◆ WaitHandle
WaitHandle System.Threading.CancellationToken.WaitHandle |
|
get |
Gets a T:System.Threading.WaitHandle that is signaled when the token is canceled.
- Returns
- A T:System.Threading.WaitHandle that is signaled when the token is canceled.
- Exceptions
-
T:System.ObjectDisposedException | The associated T:System.Threading.CancellationTokenSource has been disposed. |
Definition at line 71 of file CancellationToken.cs.
The documentation for this struct was generated from the following file: