LogProviderInfoEnumerator.Current プロパティ

定義

コレクションの現在の LogProviderInfo 要素を取得します。

public:
 property Microsoft::SqlServer::Dts::Runtime::LogProviderInfo ^ Current { Microsoft::SqlServer::Dts::Runtime::LogProviderInfo ^ get(); };
public Microsoft.SqlServer.Dts.Runtime.LogProviderInfo Current { get; }
member this.Current : Microsoft.SqlServer.Dts.Runtime.LogProviderInfo
Public ReadOnly Property Current As LogProviderInfo

プロパティ値

LogProviderInfo

現在の LogProviderInfo オブジェクト。

次のコード サンプルでは、列挙子を作成してから、Current メソッド、MoveNext メソッド、および Reset メソッドを使用してコレクションを移動します。

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  

サンプル出力:

The collection contains the following values:

[0] SSIS log provider for Text files

[1] SQL Server Profilerの SSIS ログ プロバイダー

[2] SSIS log provider for SQL Server

[3] SSIS log provider for Windows Event Log

[4] SSIS log provider for XML files

注釈

列挙子を作成した後や Reset メソッドを呼び出した後は、Current プロパティの値を列挙子が読み取る前に、MoveNext メソッドを呼び出して列挙子をコレクションの先頭の要素に進めておく必要があります。そうしないと、Current は未定義となり、例外がスローされます。

前回の MoveNext の呼び出しで false が返された場合 (コレクションの末尾であることを示します)、その後で Current を呼び出しても例外がスローされます。

Currentは、列挙子の位置を移動せず、呼び出されるまで同じオブジェクトMoveNextResetを返すCurrent連続する呼び出しを行います。

列挙子は、コレクションが変更されない限り有効です。 要素の追加、変更、削除など、コレクションに変更が加えられた場合、列挙子は無効になり、回復不能になります。したがって、次の呼び出しまたはMoveNextResetスローInvalidOperationExceptionします。 コレクションが呼び出しと呼び出しMoveNextCurrentの間で変更された場合は、Current列挙子が無効になっている場合でも、設定されている要素を返します。

適用対象