共用方式為


Task.CurrentId 屬性

定義

回傳目前執行中的 Task的 ID 。

public:
 static property Nullable<int> CurrentId { Nullable<int> get(); };
public static int? CurrentId { get; }
static member CurrentId : Nullable<int>
Public Shared ReadOnly Property CurrentId As Nullable(Of Integer)

屬性值

系統指派給當前執行任務的整數。

備註

CurrentId是 VisualShared Basic 中的一個static屬性,用來從執行中的程式碼取得目前執行任務的識別碼。 它與 property Id (屬性)不同,後者會回傳特定 Task 實例的識別碼。 如果你嘗試從任務執行的程式碼外部取得 CurrentId 該值,該屬性會回傳 null

請注意,雖然碰撞非常罕見,但任務識別碼並不保證是唯一。

適用於

另請參閱