言語

PipelineComponentInfos.Contains(Object) メソッド

定義

例外を投げずにインデックスを使ってアクセス可能かどうかを示すブール値を返します。

public:
 bool Contains(System::Object ^ index);
public bool Contains(object index);
member this.Contains : obj -> bool
Public Function Contains (index As Object) As Boolean

パラメーター

index
Object

コレクション内で位置づけるべき PipelineComponentInfo オブジェクトの名前、識別子、IDまたはインデックス

返品

コレクションが名前、識別、ID、インデックスのいずれかでアクセス可能かどうかを示すブール値です。 trueの値は、構文PipelineComponentInfos [index]を使ってコレクションにアクセスできることを示します。 falseの値は、インデックス作成で PipelineComponentInfos コレクションからアイテムを取得することはできません。このプロパティを使用すると例外が発生します。

以下のコードサンプルでは、 Contains メソッドを使って「Merge」という名前のパイプラインコンポーネントがコレクションに含まれているかどうかを判定します。 メソッドは Booleanを返します。

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;  

            // Search the collection by name.  
            if (pInfos.Contains("Merge"))  
                Console.WriteLine("The collection contains {0} pipeline component", pInfos[0].Name);  
            else  
                Console.WriteLine("The collection does not contain {0} pipeline component", pInfos[0].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   

            ' Search the collection by name.  
            If pInfos.Contains("Merge") Then  
                Console.WriteLine("The collection contains {0} pipeline component", pInfos(0).Name)  
            Else   
                Console.WriteLine("The collection does not contain {0} pipeline component", pInfos(0).Name)  
            End If  
        End Sub  
    End Class  
End Namespace  

出力例:

このコレクションには、Merge pipelineコンポーネントが含まれています

適用対象