TaskInfos.Item[Object] 속성

정의

컬렉션에서 a TaskInfo 를 가져옵니다.

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

매개 변수

index
Object

컬렉션에서 가져올 이름, ID 또는 인덱스 TaskInfo .

속성 값

TaskInfo 개체

예제

다음 코드 예시는 두 가지 방법으로 컬렉션에서 항목을 검색합니다. 첫 번째 방법은 구문을 사용하여 tInfos[0] 컬렉션의 첫 위치에 있는 전체 객체를 검색하여 객체에 tInfo 배치합니다. 이제 평소처럼 객체에서 tInfo 모든 속성을 가져올 수 있습니다. 두 번째 방법은 컬렉션 내 첫 번째 객체에서 특정 속성을 가져오는 방법을 보여줍니다.

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();  
            TaskInfos tInfos = app.TaskInfos;  

            //Using the Item method syntax of [x], obtain the first   
            //entry.  
            TaskInfo tInfo = tInfos[0];  
            String nameOfFirstItem = tInfos[0].Name;  
           //This could also be done using the Name property, as  
           //demonstrated by this next line of commented code.  
           //TaskInfo tInfo = tInfos["Execute Package Task"];  
           //You can also use the ID property.  
           // TaskInfo tInfo = tInfos["{8FE4A9F8-D077-436B-9B00-C1EEAEFAFE55}"];  

            //Print the name of the task object located at position [0].  
            Console.WriteLine("The task ID of the first provider is: {0}", tInfo.ID);  
            Console.WriteLine("The Name of the first task is: {0}", nameOfFirstItem);  
        }  
    }  
}  
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 tInfos As TaskInfos =  app.TaskInfos   

            'Using the Item method syntax of [x], obtain the first   
            'entry.  
            Dim tInfo As TaskInfo =  tInfos(0)   
            Dim nameOfFirstItem As String =  tInfos(0).Name   
           'This could also be done using the Name property, as  
           'demonstrated by this next line of commented code.  
           'TaskInfo tInfo = tInfos["Execute Package Task"];  
           'You can also use the ID property.  
           ' TaskInfo tInfo = tInfos["{8FE4A9F8-D077-436B-9B00-C1EEAEFAFE55}"];  

            'Print the name of the task object located at position [0].  
            Console.WriteLine("The task ID of the first provider is: {0}", tInfo.ID)  
            Console.WriteLine("The Name of the first task is: {0}", nameOfFirstItem)  
        End Sub  
    End Class  
End Namespace  

샘플 출력:

첫 번째 제공자의 작업 ID는 {8FE4A9F8-D077-436B-9B00-C1EEAEFAFE55}입니다.

첫 번째 작업의 이름은 다음과 같습니다: 패키지 실행 작업

설명

메서드 호출 Contains 이 반환 true되면 구문 TaskInfos[index]를 사용하여 컬렉션 내 지정된 요소에 접근할 수 있습니다. 하지만 메서드 호출 Contains 이 를 반환하면 false이 속성은 예외를 던집니다. C#에서 이 속성은 클래스의 인덱서 TaskInfos 입니다.

적용 대상