Table of Contents

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

cancellationToken CancellationToken

The 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

cancellationTokenSource CancellationTokenSource

The cancellation token source.

Properties

Token

Gets the combined cancellation token.

public CancellationToken Token { get; }

Property Value

CancellationToken

Methods

Dispose()

Disposes the CancellationTokenSource behind this combined token, if any.

public void Dispose()

Equals(CombinedCancellationToken)

public bool Equals(CancellationTokenExtensions.CombinedCancellationToken other)

Parameters

other CancellationTokenExtensions.CombinedCancellationToken

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Operators

operator ==(CombinedCancellationToken, CombinedCancellationToken)

Checks whether two instances of CancellationTokenExtensions.CombinedCancellationToken are equal.

public static bool operator ==(CancellationTokenExtensions.CombinedCancellationToken left, CancellationTokenExtensions.CombinedCancellationToken right)

Parameters

left CancellationTokenExtensions.CombinedCancellationToken

The left operand.

right CancellationTokenExtensions.CombinedCancellationToken

The right operand.

Returns

bool

true if they are equal; false otherwise.

operator !=(CombinedCancellationToken, CombinedCancellationToken)

Checks whether two instances of CancellationTokenExtensions.CombinedCancellationToken are not equal.

public static bool operator !=(CancellationTokenExtensions.CombinedCancellationToken left, CancellationTokenExtensions.CombinedCancellationToken right)

Parameters

left CancellationTokenExtensions.CombinedCancellationToken

The left operand.

right CancellationTokenExtensions.CombinedCancellationToken

The right operand.

Returns

bool

true if they are not equal; false if they are equal.