言語

ConnectionInfos.Contains(Object) メソッド

定義

ConnectionInfosコレクションのConnectionInfo項目を名前、インデックス、ID、または識別パラメータをインデックスとして使用できるかどうかを示すブール値を返します。

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

コレクション内のオブジェクトの名前、インデックス、ID、または識別を一致させる。

返品

trueは、構文 ConnectionInfos[index]を使ってアイテムを取得できることを示します;falseはインデックス作成が ConnectionInfos コレクションからアイテムを取得するために使えないことを示します。

以下の例は「DTS 接続マネージャー for Files」という接続のコレクション検索を示しています。 検索で使われる名前は、 Name プロパティで返された名前です。

using System;  
using System.Collections.Generic;  
using System.Text;  
using Microsoft.SqlServer.Dts.Runtime;  

namespace ConnInfosTest  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            Application dtsApplication = new Application();  
            ConnectionInfos connectionInfos = dtsApplication.ConnectionInfos;  

            // Search for the File connection in the collection  
            if (connectionInfos.Contains("DTS Connection Manager for Files"))  
                Console.WriteLine("The collection contains the FILE connection");  
            else  
                Console.WriteLine("The collection does not contain the FILE connection");  
            Console.WriteLine();  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace ConnInfosTest  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            Dim dtsApplication As Application =  New Application()   
            Dim connectionInfos As ConnectionInfos =  dtsApplication.ConnectionInfos   

            ' Search for the File connection in the collection  
            If connectionInfos.Contains("DTS Connection Manager for Files") Then  
                Console.WriteLine("The collection contains the FILE connection")  
            Else   
                Console.WriteLine("The collection does not contain the FILE connection")  
            End If  
            Console.WriteLine()  
        End Sub  
    End Class  
End Namespace  

出力例:

The collection contains the FILE connection

適用対象