LogProviderInfos.GetEnumerator 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳一個列舉器,用於在重複處理集合。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然後對集合進行遍歷。
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 日誌提供者