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 а затем выполняется итерацию по коллекции.
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] Поставщик журналов служб SSIS для SQL Server Profiler
[2] Поставщик журналов служб SSIS для SQL Server
[3] Поставщик журналов служб SSIS для журнала событий Windows
[4] Поставщик журналов служб SSIS для XML-файлов