Task.CompletedTask 屬性

定義

取得已成功完成的工作。Gets a task that has already completed successfully.

public:
 static property System::Threading::Tasks::Task ^ CompletedTask { System::Threading::Tasks::Task ^ get(); };
public static System.Threading.Tasks.Task CompletedTask { get; }
member this.CompletedTask : System.Threading.Tasks.Task
Public Shared ReadOnly Property CompletedTask As Task

屬性值

Task

成功完成的工作。The successfully completed task.

備註

這個屬性會傳回其 Status 屬性設定為的工作 RanToCompletionThis property returns a task whose Status property is set to RanToCompletion. 若要建立會傳回值並執行到完成的工作,請呼叫 FromResult 方法。To create task that returns a value and runs to completion, call the FromResult method.

重複嘗試抓取此屬性值的動作不一定會傳回相同的實例。Repeated attempts to retrieve this property value may not always return the same instance.

適用於

另請參閱