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日志提供者