Task.IsCanceled Propriedade
Definição
public:
property bool IsCanceled { bool get(); };
public bool IsCanceled { get; }
member this.IsCanceled : bool
Public ReadOnly Property IsCanceled As Boolean
Valor da propriedade
true
se a tarefa foi concluída porque foi cancelada, caso contrário, false
.true
if the task has completed due to being canceled; otherwise false
.
Comentários
Um Task será concluído no estado de Canceled em qualquer uma das seguintes condições:A Task will complete in the Canceled state under any of the following conditions:
Sua CancellationToken foi marcada para cancelamento antes de a execução da tarefa ser iniciada,Its CancellationToken was marked for cancellation before the task started executing,
A tarefa confirmou a solicitação de cancelamento em sua CancellationToken já sinalizada lançando um OperationCanceledException que possui o mesmo CancellationToken.The task acknowledged the cancellation request on its already signaled CancellationToken by throwing an OperationCanceledException that bears the same CancellationToken.
A tarefa confirmou a solicitação de cancelamento em sua CancellationToken já sinalizada chamando o método ThrowIfCancellationRequested no CancellationToken.The task acknowledged the cancellation request on its already signaled CancellationToken by calling the ThrowIfCancellationRequested method on the CancellationToken.
Importante
Recuperar o valor da propriedade IsCanceled não bloqueará o thread de chamada até que a tarefa seja concluída.Retrieving the value of the IsCanceled property does not block the calling thread until the task has completed.