Struct CancellationTokenExtensions.CombinedCancellationToken
- Namespace
- Microsoft.VisualStudio.Threading
- Assembly
- Microsoft.VisualStudio.Threading.dll
Provides access to a CancellationToken that combines multiple other tokens, and allows convenient disposal of any applicable CancellationTokenSource.
public readonly struct CancellationTokenExtensions.CombinedCancellationToken : IDisposable, IEquatable<CancellationTokenExtensions.CombinedCancellationToken>
- Implements
- Inherited Members
Constructors
CombinedCancellationToken(CancellationToken)
Initializes a new instance of the CancellationTokenExtensions.CombinedCancellationToken struct that represents just a single, non-disposable CancellationToken.
public CombinedCancellationToken(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
CombinedCancellationToken(CancellationTokenSource)
Initializes a new instance of the CancellationTokenExtensions.CombinedCancellationToken struct that contains an aggregate CancellationToken whose source must be disposed.
public CombinedCancellationToken(CancellationTokenSource cancellationTokenSource)
Parameters
cancellationTokenSourceCancellationTokenSourceThe cancellation token source.
Properties
Token
Gets the combined cancellation token.
public CancellationToken Token { get; }
Property Value
Methods
Dispose()
Disposes the CancellationTokenSource behind this combined token, if any.
public void Dispose()
Equals(CombinedCancellationToken)
public bool Equals(CancellationTokenExtensions.CombinedCancellationToken other)
Parameters
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
Operators
operator ==(CombinedCancellationToken, CombinedCancellationToken)
Checks whether two instances of CancellationTokenExtensions.CombinedCancellationToken are equal.
public static bool operator ==(CancellationTokenExtensions.CombinedCancellationToken left, CancellationTokenExtensions.CombinedCancellationToken right)
Parameters
leftCancellationTokenExtensions.CombinedCancellationTokenThe left operand.
rightCancellationTokenExtensions.CombinedCancellationTokenThe right operand.
Returns
operator !=(CombinedCancellationToken, CombinedCancellationToken)
Checks whether two instances of CancellationTokenExtensions.CombinedCancellationToken are not equal.
public static bool operator !=(CancellationTokenExtensions.CombinedCancellationToken left, CancellationTokenExtensions.CombinedCancellationToken right)
Parameters
leftCancellationTokenExtensions.CombinedCancellationTokenThe left operand.
rightCancellationTokenExtensions.CombinedCancellationTokenThe right operand.