語言

Task 建構函式

定義

初始化 Task 類別的新執行個體。

protected:
 Task();
protected Task();
Protected Sub New ()

範例

以下範例程式碼是利用建構子建立新的 BulkInsertTask 。

BulkInsertTask myTask = new BulkInsertTask();  
Dim myTask As BulkInsertTask =  New BulkInsertTask()  

備註

對於繼承自 Task的任務,每個任務的範例部分範例說明如何呼叫任務建構子。 不過,在大多數情況下,你會以套件成員的身份建立任務。 欲了解更多關於施放任務的資訊,請參閱 中的 Add備註。

Package pkg = new Package();  
Executable exec1 = pkg.Executables.Add("STOCK:BulkInsertTask");  
TaskHost th = exec1 as TaskHost;  
// You can cast the InnerObject of the TaskHost  
// to the specific class.  
// For the code samples, the task properties are accessed using  
// the Properties of the TaskHost.  
//BulkInsertTask myTask = th.InnerObject as BulkInsertTask;  
Dim pkg As Package =  New Package()   
Dim exec1 As Executable =  pkg.Executables.Add("STOCK:BulkInsertTask")   
Dim th As TaskHost =  exec1 as TaskHost   
' You can cast the InnerObject of the TaskHost  
' to the specific class.  
' For the code samples, the task properties are accessed using  
' the Properties of the TaskHost.  
'BulkInsertTask myTask = th.InnerObject as BulkInsertTask;  

的性質與方法 BulkInsertTask 可用變 TaskHost 數 th。

適用於