ConnectionInfos.Item[Object] 속성

정의

컬렉션에서 ConnectionInfo 개체를 이름, 인덱스 또는 ID별로 검색합니다.

public:
 property Microsoft::SqlServer::Dts::Runtime::ConnectionInfo ^ default[System::Object ^] { Microsoft::SqlServer::Dts::Runtime::ConnectionInfo ^ get(System::Object ^ index); };
public Microsoft.SqlServer.Dts.Runtime.ConnectionInfo this[object index] { get; }
member this.Item(obj) : Microsoft.SqlServer.Dts.Runtime.ConnectionInfo
Default Public ReadOnly Property Item(index As Object) As ConnectionInfo

매개 변수

index
Object

컬렉션에서 반환할 개체의 이름, 인덱스 또는 ID입니다.

속성 값

컬렉션에 있는 ConnectionInfo 개체 중 index 매개 변수에 지정된 이름, 인덱스 또는 ID와 일치하는 개체입니다.

예제

다음 코드 예제에서는 두 가지 메서드를 사용하여 컬렉션에서 항목을 검색합니다. 첫 번째 메서드는 구문을 사용하여 connectionInfos[0] 컬렉션의 첫 번째 위치에 있는 전체 개체를 검색한 다음 개체에 connInfo 배치합니다. 이제 개체에서 평소와 같이 모든 속성을 검색할 ConnectionInfo 수 있습니다. 두 번째 메서드는 컬렉션의 첫 번째 개체에서 특정 속성을 검색합니다.

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

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

            //Using the Item method syntax of [x], obtain the first entry and a name.  
            ConnectionInfo connInfo = connectionInfos[0];  
            String nameOfFirstItem = connectionInfos[0].Name;  

            //Print the name of the log provider object located at position [0].  
            Console.WriteLine("The ID of the first connection info is: {0}", connInfo.ID);  
            Console.WriteLine("The Name of the first connection info is: {0}", nameOfFirstItem);  

        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

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

            'Using the Item method syntax of [x], obtain the first entry and a name.  
            Dim connInfo As ConnectionInfo =  connectionInfos(0)   
            Dim nameOfFirstItem As String =  connectionInfos(0).Name   

            'Print the name of the log provider object located at position [0].  
            Console.WriteLine("The ID of the first connection info is: {0}", connInfo.ID)  
            Console.WriteLine("The Name of the first connection info is: {0}", nameOfFirstItem)  

        End Sub  
    End Class  
End Namespace  

샘플 출력:

The ID of the first connection info is: {41F5EFE4-E91A-4EB0-BF10-D40FD48B3C03}

The Name of the first connection info is: DTS Connection Manager for Files

설명

메서드 호출이 Contains 반환 true되면 구문을 ConnectionInfos[index]사용하여 컬렉션에서 지정된 요소에 액세스할 수 있습니다. 메서드가 Contains 반환 false되면 이 속성은 예외를 throw합니다. C#에서 이 속성은 ConnectionInfos 클래스의 인덱서입니다.

적용 대상