CancellationToken.Equals Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Determines whether the current CancellationToken instance is equal to the specified token.
Overloads
Equals(Object) |
Determines whether the current CancellationToken instance is equal to the specified Object. |
Equals(CancellationToken) |
Determines whether the current CancellationToken instance is equal to the specified token. |
Equals(Object)
- Source:
- CancellationToken.cs
- Source:
- CancellationToken.cs
- Source:
- CancellationToken.cs
Determines whether the current CancellationToken instance is equal to the specified Object.
public:
override bool Equals(System::Object ^ other);
public override bool Equals (object other);
public override bool Equals (object? other);
override this.Equals : obj -> bool
Public Overrides Function Equals (other As Object) As Boolean
Parameters
- other
- Object
The other object to compare with this instance.
Returns
true
if other
is a CancellationToken and if the two instances are equal; otherwise, false
. See the Remarks section for more information.
Exceptions
An associated CancellationTokenSource has been disposed.
Remarks
Two cancellation tokens are equal if any one of the following conditions is true:
They are associated with the same CancellationTokenSource.
They were both constructed from public CancellationToken constructors, and their CancellationToken.IsCancellationRequested values are equal.
The value of both cancellation tokens is CancellationToken.None.
See also
Applies to
Equals(CancellationToken)
- Source:
- CancellationToken.cs
- Source:
- CancellationToken.cs
- Source:
- CancellationToken.cs
Determines whether the current CancellationToken instance is equal to the specified token.
public:
bool Equals(System::Threading::CancellationToken other);
public:
virtual bool Equals(System::Threading::CancellationToken other);
public bool Equals (System.Threading.CancellationToken other);
override this.Equals : System.Threading.CancellationToken -> bool
Public Function Equals (other As CancellationToken) As Boolean
Parameters
- other
- CancellationToken
The other CancellationToken to compare with this instance.
Returns
true
if the instances are equal; otherwise, false
. See the Remarks section for more information.
Implements
Remarks
Two cancellation tokens are equal if any one of the following conditions is true:
They are associated with the same CancellationTokenSource.
They were both constructed from public CancellationToken constructors, and their CancellationToken.IsCancellationRequested values are equal.
The value of both cancellation tokens is CancellationToken.None.