ScriptTask 建構函式

定義

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

public:
 ScriptTask();
public ScriptTask ();
Public Sub New ()

範例

下列程式碼範例會使用此函式來建立新的 ScriptTask

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

備註

雖然您可以呼叫工作的函式,但通常會將工作建立為封裝的成員。

在下列範例中, ScriptTask 可以使用變數來使用的屬性和方法 Properties TaskHost th 。 如需轉換工作的詳細資訊,請參閱中的備註 Add

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

適用於