PipelineComponentInfoEnumerator.Current 屬性

定義

從集合中取得目前的 PipelineComponentInfo 元素。

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

屬性值

PipelineComponentInfo

集合中的目前 PipelineComponentInfo 元素。

範例

下列程式碼範例會建立列舉值,然後使用 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  

範例輸出:

集合包含下列值:

[0] 合併

[1] 合併聯結

[2] 查閱

[3] Audit

[4] 資料列取樣

[5] 維度處理

[6] 詞彙解壓縮

[7] 資料採礦模型訓練

[8] OLE DB 來源

[9] 字元對應

[10] 模糊群組

備註

建立枚舉器或呼叫方法之後, Reset 必須呼叫方法,將 MoveNext 列舉值前移至集合的第一個專案,枚舉器才能讀取屬性的值 Current ; 否則, Current 會未定義,而且會擲回例外狀況。

Current如果最後一個呼叫 MoveNext 傳回 false ,表示集合的結尾,也會擲回例外狀況。

Current不會移動列舉值的位置,而連續的呼叫會傳回 Current 相同的物件,直到 MoveNext 呼叫或為止 Reset

只要集合維持不變,列舉值就仍維持有效。 如果對集合進行了變更,例如加入、修改或刪除專案,枚舉器會失效,且會變得無法復原。因此,下一次呼叫或時,會擲回 MoveNext Reset InvalidOperationException 。 不過,如果在和的呼叫之間修改集合,則會傳回 MoveNext Current Current 其設定的元素,即使列舉值已失效也一樣。

適用於