LogProviderInfos.GetEnumerator 方法

定义

返回用于遍历 LogProviderInfos 集合的枚举器。

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

返回

LogProviderInfoEnumerator

用于遍历集合的 LogProviderInfoEnumerator 枚举器。

示例

下面的代码示例使用GetEnumerator该方法创建一个LogProviderInfoEnumerator,然后循环访问集合。

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

namespace LogProvInfoProperties  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
        Application app = new Application();  
        LogProviderInfos infos = app.LogProviderInfos;  

        //Create the Enumerator.  
        LogProviderInfoEnumerator myEnumerator = infos.GetEnumerator();  
        Console.WriteLine("The collection contains the following values:");  
        //Iterate over the collection using the indexer instead of foreach.  
        int i = 0;  
            while ((myEnumerator.MoveNext()) && (myEnumerator.Current != null))  
                Console.WriteLine("[{0}] {1}", i++, myEnumerator.Current.Name);  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace LogProvInfoProperties  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
        Dim app As Application =  New Application()   
        Dim infos As LogProviderInfos =  app.LogProviderInfos   

        'Create the Enumerator.  
        Dim myEnumerator As LogProviderInfoEnumerator =  infos.GetEnumerator()   
        Console.WriteLine("The collection contains the following values:")  
        'Iterate over the collection using the indexer instead of foreach.  
        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] 文本文件的 SSIS 日志提供程序

[1] SQL Server Profiler的 SSIS 日志提供程序

[2] SQL Server的 SSIS 日志提供程序

[3] Windows 事件日志的 SSIS 日志提供程序

[4] XML 文件的 SSIS 日志提供程序

适用于