語言

PipelineComponentInfos.Item[Object] 屬性

定義

從集合中回傳一個 PipelineComponentInfo 物件。

public:
 property Microsoft::SqlServer::Dts::Runtime::PipelineComponentInfo ^ default[System::Object ^] { Microsoft::SqlServer::Dts::Runtime::PipelineComponentInfo ^ get(System::Object ^ index); };
public Microsoft.SqlServer.Dts.Runtime.PipelineComponentInfo this[object index] { get; }
member this.Item(obj) : Microsoft.SqlServer.Dts.Runtime.PipelineComponentInfo
Default Public ReadOnly Property Item(index As Object) As PipelineComponentInfo

參數

index
Object

收藏中要找到的項目名稱、ID、描述或索引。

屬性值

PipelineComponentInfo 物件。

範例

以下程式碼範例是利用兩種方法從集合中取得一個項目。 第一種方法是利用語 pInfos[…] 法擷取集合中位於第一位置的整個物件並將其放入物件中 pInfo 。 你現在可以像平常一樣從物件中取得所有屬性 pInfo 。 第二種方法示範如何利用名稱作為索引器,從集合中的「合併」物件中取得特定屬性——描述。

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;  

            //Using the Item method syntax of [x], obtain the description  
            // of the Merge entry.  
            PipelineComponentInfo pInfo = pInfos["Merge"];  
            String nameOfFirstItem = pInfos["Merge"].Description;  
            Console.WriteLine("Description of Merge entry: {0}", nameOfFirstItem);  
        }  
    }  
}  
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   

            'Using the Item method syntax of [x], obtain the description  
            ' of the Merge entry.  
            Dim pInfo As PipelineComponentInfo =  pInfos("Merge")   
            Dim nameOfFirstItem As String =  pInfos("Merge").Description   
            Console.WriteLine("Description of Merge entry: {0}", nameOfFirstItem)  
        End Sub  
    End Class  
End Namespace  

範例輸出:

合併條目的說明:合併轉換

備註

如果呼叫 Contains 方法回傳 true,你可以透過語法 PipelineComponentInfos[index]存取集合中指定的元素。 然而,如果方法 Contains 回傳 false,這個特性會拋出例外。 在 C# 中,這個屬性就是類別的 PipelineComponentInfos 索引器

適用於