BreakpointTargets.GetEnumerator 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回可逐一查看 BreakpointTargetEnumerator 集合的 BreakpointTargets。
public:
Microsoft::SqlServer::Dts::Runtime::BreakpointTargetEnumerator ^ GetEnumerator();
public Microsoft.SqlServer.Dts.Runtime.BreakpointTargetEnumerator GetEnumerator ();
override this.GetEnumerator : unit -> Microsoft.SqlServer.Dts.Runtime.BreakpointTargetEnumerator
Public Function GetEnumerator () As BreakpointTargetEnumerator
傳回
BreakpointTargetEnumerator 集合的 BreakpointTargets。
範例
下列程式碼範例會 BreakpointTargetEnumerator 使用方法建立 GetEnumerator ,然後逐一查看集合。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.FileSystemTask;
namespace BreakpointTarget_Expression
{
class Program
{
static void Main(string[] args)
{
Package pkg = new Package();
TaskHost taskHost = (TaskHost)pkg.Executables.Add("STOCK:FileSystemTask");
BreakpointTargets bptargets = pkg.GetBreakpointTargets(taskHost, false);
// Create the enumerator.
BreakpointTargetEnumerator myEnumerator = bptargets.GetEnumerator();
Console.WriteLine("The collection contains the following values:");
int i = 0;
while ((myEnumerator.MoveNext()) && (myEnumerator.Current != null))
Console.WriteLine("[{0}] {1}", i++, myEnumerator.Current.Description);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask
Namespace BreakpointTarget_Expression
Class Program
Shared Sub Main(ByVal args() As String)
Dim pkg As Package = New Package()
Dim taskHost As TaskHost = CType(pkg.Executables.Add("STOCK:FileSystemTask"), TaskHost)
Dim bptargets As BreakpointTargets = pkg.GetBreakpointTargets(taskHost,False)
' Create the enumerator.
Dim myEnumerator As BreakpointTargetEnumerator = bptargets.GetEnumerator()
Console.WriteLine("The collection contains the following values:")
Dim i As Integer = 0
While (myEnumerator.MoveNext()) &&(myEnumerator.Current <> Nothing)
Console.WriteLine("[{0}] {1}",i = Console.WriteLine("[{0}] {1}",i + 1
End While
End Sub
End Class
End Namespace
範例輸出:
集合包含下列值:
[0] 當容器收到 OnPreExecute 事件時中斷
[1] 當容器收到 OnPostExecute 事件時中斷
[2] 當容器收到 OnError 事件時中斷
[3] 當容器收到 OnWarning 事件時中斷
[4] 當容器收到 OnInformation 事件時中斷
[5] 當容器收到 OnTaskFailed 事件時中斷
[6] 當容器收到 OnProgress 事件時中斷
[7] 當容器收到 OnQueryCancel 事件時中斷
[8] 當容器收到 OnVariableValueChanged 事件時中斷
[9] 當容器收到 OnCustomEvent 事件時中斷