Task.IsCompleted 屬性

定義

取得值,這個值表示工作是否已經完成。Gets a value that indicates whether the task has completed.

public:
 property bool IsCompleted { bool get(); };
public bool IsCompleted { get; }
member this.IsCompleted : bool
Public ReadOnly Property IsCompleted As Boolean

屬性值

true 工作是否已完成(也就是,工作是三個最終狀態的其中一個: RanToCompletionFaultedCanceled);否則,falsetrue if the task has completed (that is, the task is in one of the three final states: RanToCompletion, Faulted, or Canceled); otherwise, false.

實作

備註

重要

在工作完成之前,抓取 Task.IsCompleted 屬性的值不會封鎖呼叫執行緒。Retrieving the value of the Task.IsCompleted property does not block the calling thread until the task has completed.

適用於