ScriptTask 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 ScriptTask 類別的新執行個體。
public:
ScriptTask();
public ScriptTask();
Public Sub New ()
範例
以下範例程式碼是利用建構子建立新的 ScriptTask 。
ScriptTask myTask = new ScriptTask();
Dim myTask As ScriptTask = New ScriptTask()
備註
雖然你可以呼叫任務建構器,但通常你是將任務作為套件的成員來建立。
以下範例中,利用變數 的性質與方法ScriptTask可用PropertiesTaskHost。 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