CancellationToken(Boolean) CancellationToken(Boolean) CancellationToken(Boolean) CancellationToken(Boolean) Constructor

定义

初始化 CancellationTokenInitializes the CancellationToken.

public:
 CancellationToken(bool canceled);
public CancellationToken (bool canceled);
new System.Threading.CancellationToken : bool -> System.Threading.CancellationToken
Public Sub New (canceled As Boolean)

参数

canceled
Boolean Boolean Boolean Boolean

标记的已取消状态。The canceled state for the token.

注解

使用此构造函数创建的令牌将保留在指定的已取消状态canceled参数。Tokens created with this constructor will remain in the canceled state specified by the canceled parameter. 如果canceledfalse,这两种CanBeCanceledIsCancellationRequestedfalseIf canceled is false, both CanBeCanceled and IsCancellationRequested will be false.

如果canceledtrue,这两种CanBeCanceledIsCancellationRequestedtrueIf canceled is true, both CanBeCanceled and IsCancellationRequested will be true.

适用于

另请参阅