名前、インデックス、または ID パラメータをインデックスとして使用して、ConnectionInfos コレクション内の ConnectionInfo 項目にアクセスできるかどうかを示す Boolean を返します。
名前空間: Microsoft.SqlServer.Dts.Runtime
アセンブリ: Microsoft.SqlServer.ManagedDTS (microsoft.sqlserver.manageddts.dll 内)
構文
'宣言
Public Function Contains ( _
index As Object _
) As Boolean
public bool Contains (
Object index
)
public:
bool Contains (
Object^ index
)
public boolean Contains (
Object index
)
public function Contains (
index : Object
) : boolean
パラメータ
- index
コレクション内の一致するオブジェクトの名前、インデックス、または ID です。
戻り値
ConnectionInfos[index] 構文を使用して項目を取得できる場合は true、ConnectionInfos コレクションからの項目の取得にインデックスを使用できない場合は false です。
使用例
次の例では、コレクションから「DTS Connection Manager 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
スレッド セーフ
この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
開発プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
対象プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
参照
関連項目
ConnectionInfos Class
ConnectionInfos Members
Microsoft.SqlServer.Dts.Runtime Namespace