次の方法で共有


PipelineComponentInfoEnumerator.Current プロパティ

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

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Public ReadOnly Property Current As PipelineComponentInfo 
    Get
'使用
Dim instance As PipelineComponentInfoEnumerator 
Dim value As PipelineComponentInfo 

value = instance.Current
public PipelineComponentInfo Current { get; }
public:
property PipelineComponentInfo^ Current {
    PipelineComponentInfo^ get ();
}
member Current : PipelineComponentInfo
function get Current () : PipelineComponentInfo

プロパティ値

型: Microsoft.SqlServer.Dts.Runtime.PipelineComponentInfo
コレクション内にある現在の PipelineComponentInfo 要素です。

説明

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

また、MoveNext の最後の呼び出しでコレクションの末尾を示す false が返された場合、Current を呼び出すと例外がスローされます。

Current で列挙子の位置は移動されません。Current を連続して呼び出すと、MoveNext または Reset が呼び出されるまで同じオブジェクトが返されます。

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

使用例

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

[C#]

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

namespace TaskInfos_Item
{
    class Program
    {
        static void Main(string[] args)
        {
            Application app = new Application();
            PipelineComponentInfos pInfos = app.PipelineComponentInfos;

            //Create the Enumerator.
            PipelineComponentInfoEnumerator myEnumerator= pInfos.GetEnumerator();
            Console.WriteLine("The collection contains the following values:");
            int i = 0;
            while ((myEnuemrator.MoveNext()) && (myEnuemrator.Current != null))
                Console.WriteLine("[{0}] {1}", i++, myEnuemrator.Current.Name);
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
 
Namespace TaskInfos_Item
    Class Program
        Shared  Sub Main(ByVal args() As String)
            Dim app As Application =  New Application() 
            Dim pInfos As PipelineComponentInfos =  app.PipelineComponentInfos 
 
            'Create the Enumerator.
            Dim myEnumeratorAs PipelineComponentInfoEnumerator =  pInfos.GetEnumerator() 
            Console.WriteLine("The collection contains the following values:")
            Dim i As Integer =  0 
            While (myEnuemrator.MoveNext()) &&(myEnuemrator.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] Merge

[1] Merge Join

[2] Lookup

[3] Audit

[4] Row Sampling

[5] Dimension Processing

[6] Term Extraction

[7] Data Mining Model Training

[8] OLE DB Source

[9] Character Map

[10] Fuzzy Grouping

関連項目

参照

PipelineComponentInfoEnumerator クラス

Microsoft.SqlServer.Dts.Runtime 名前空間