다음을 통해 공유


Executables.GetEnumerator 메서드

정의

ExecutableEnumerator 컬렉션을 반복할 수 있는 Executables를 반환합니다.

public:
 Microsoft::SqlServer::Dts::Runtime::ExecutableEnumerator ^ GetEnumerator();
public Microsoft.SqlServer.Dts.Runtime.ExecutableEnumerator GetEnumerator ();
override this.GetEnumerator : unit -> Microsoft.SqlServer.Dts.Runtime.ExecutableEnumerator
Public Function GetEnumerator () As ExecutableEnumerator

반환

ExecutableEnumerator 컬렉션을 반복할 수 있는 Executables입니다.

예제

다음 코드 예제에서는 패키지에 대량 삽입 태스크를 추가하고, 컬렉션을 만들고 Executables , 열거자를 만들고, 다음을 사용하여 TaskHost작업의 이름을 표시합니다.

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  

namespace Executables_API  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            // Create the package and add the BulkInsertTask.  
            Package pkg = new Package();  
            Executable exec = pkg.Executables.Add("STOCK:BulkInsertTask");  

            // Obtain the collection.  
            Executables pgkExecs = pkg.Executables;  

            //Create the Enumerator.  
            ExecutableEnumerator myEnumerator = pgkExecs.GetEnumerator();  
            Console.WriteLine("The collection contains the following values:");  
            int i = 0;  
            Executable myExec;  
            TaskHost myTH;  
            while ((myEnumerator.MoveNext()) && (myEnumerator.Current != null))  
            {  
                myExec = (Executable)myEnumerator.Current;  
                myTH = (TaskHost)myExec;  
                Console.WriteLine("[{0}] {1}", i++, myTH.Name);  
            }  
            // Reset puts the index pointer before the beginning.  
            // Do not retrieve from the collection until MoveNext is called.  
            myEnumerator.Reset();  
            myEnumerator.MoveNext();  

        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace Executables_API  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            ' Create the package and add the BulkInsertTask.  
            Dim pkg As Package =  New Package()   
            Dim exec As Executable =  pkg.Executables.Add("STOCK:BulkInsertTask")   

            ' Obtain the collection.  
            Dim pgkExecs As Executables =  pkg.Executables   

            'Create the Enumerator.  
            Dim myEnumerator As ExecutableEnumerator =  pgkExecs.GetEnumerator()   
            Console.WriteLine("The collection contains the following values:")  
            Dim i As Integer =  0   
            Dim myExec As Executable  
            Dim myTH As TaskHost  
            While (myEnumerator.MoveNext()) &&(myEnumerator.Current <> Nothing)  
                myExec = CType(myEnumerator.Current, Executable)  
                myTH = CType(myExec, TaskHost)  
                Console.WriteLine("[{0}] {1}",i = Console.WriteLine("[{0}] {1}",i + 1  
            End While  
            ' Reset puts the index pointer before the beginning.  
            ' Do not retrieve from the collection until MoveNext is called.  
            myEnumerator.Reset()  
            myEnumerator.MoveNext()  
         End Sub  
    End Class  
End Namespace  

샘플 출력:

The collection contains the following values:

[0] {C435F0C7-97E8-4DCC-A0FF-C6C805D9F64E}

적용 대상