다음을 통해 공유


ConnectionInfos.Contains Method

Returns a Boolean that indicates whether the ConnectionInfo items in the ConnectionInfos collection can be accessed by using the name, index, ID, or identity parameter as the index.

네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS (in 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
    The name, index, ID, or identity of the object in the collection to match.

반환 값

true indicates that you can retrieve the item using the syntax ConnectionInfos[index]; false indicates that indexing cannot be used to retrieve items from the ConnectionInfos collection.

The following example shows a search of the collection for the connection "DTS Connection Manager for Files". The name used in the search is the name returned in the Name property.

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

Sample Output:

The collection contains the FILE connection

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

ConnectionInfos Class
ConnectionInfos Members
Microsoft.SqlServer.Dts.Runtime Namespace