LogEntryInfoEnumerator.Current プロパティ

定義

現在の LogEntryInfo オブジェクトをコレクションから取得します。

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

プロパティ値

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

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

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

namespace LogEntryInfosTest  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            // The package is one of the SSIS Samples.  
            string mySample = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";  

            // Create the Application, and load the sample.  
            Application app = new Application();  
            Package pkg = app.LoadPackage(mySample, null);  

            //Create the Enumerator.  
            LogEntryInfos leInfos = pkg.LogEntryInfos;  
            LogEntryInfoEnumerator myEnumerator = leInfos.GetEnumerator();  
            Console.WriteLine("The collection contains the following values:");  
            int i = 0;  
            while ((myEnumerator.MoveNext()) && (myEnumerator.Current != null))  
                Console.WriteLine("[{0}] {1}", i++, myEnumerator.Current);  

            Console.WriteLine();  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace LogEnTryInfosTest  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            ' The package is one of the SSIS Samples.  
            Dim mySample As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx"   

            ' Create the Application, and load the sample.  
            Dim app As Application =  New Application()   
            Dim pkg As Package =  app.LoadPackage(mySample,Nothing)   

            'Create the Enumerator.  
            Dim leInfos As LogEnTryInfos =  pkg.LogEnTryInfos   
            Dim myEnumerator As LogEnTryInfoEnumerator =  leInfos.GetEnumerator()   
            Console.WriteLine("The collection contains the following values:")  
            Dim i As Integer =  0   
            While (myEnumerator.MoveNext()) &&(myEnumerator.Current <> Nothing)  
            Console.WriteLine("[{0}] {1}",i = Console.WriteLine("[{0}] {1}",i + 1  
            End While  

            Console.WriteLine()  
        End Sub  
    End Class  
End Namespace  

サンプル出力:

The collection contains the following values:

[0] Microsoft.SqlServer.Dts.Runtime.LogEntryInfo

注釈

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

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

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

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

適用対象