语言

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

适用于