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、またはインデックスです。

戻り値

Boolean

コレクションに名前、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  

サンプル出力:

The collection contains Merge pipeline component

適用対象