Share via


Task コンストラクター

Task クラスの新しいインスタンスを初期化します。

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Protected Sub New
'使用

Dim instance As New Task()
protected Task()
protected:
Task()
new : unit -> Task
protected function Task()

説明

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 を使用して利用できます。

使用例

次のコード サンプルでは、コンストラクターを使用して新しい BulkInsertTask を作成します。

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