PipelineComponentInfos.Contains(Object) 메서드

정의

예외를 throw하지 않고 인덱싱을 사용하여 컬렉션의 항목에 액세스할 수 있는지 여부를 나타내는 부울을 반환합니다.

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

컬렉션에서 찾을 PipelineComponentInfo 개체의 이름, ID 또는 인덱스입니다.

반환

Boolean

이름, ID, ID 또는 인덱스로 컬렉션에 액세스할 수 있는지 여부를 나타내는 부울입니다. true 값은 PipelineComponentInfos [index] 구문을 사용하여 컬렉션에 액세스할 수 있음을 나타냅니다. false 값은 컬렉션에서 항목을 검색하는 데 인덱싱을 사용할 수 없음을 PipelineComponentInfos 나타냅니다. 이 속성을 사용하면 예외가 throw됩니다.

예제

다음 코드 샘플에서는 메서드를 사용하여 Contains 이름이 "Merge"인 파이프라인 구성 요소가 컬렉션에 있는지 확인합니다. 메서드는 .를 반환합니다 Boolean.

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();  
            PipelineComponentInfos pInfos = app.PipelineComponentInfos;  

            // Search the collection by name.  
            if (pInfos.Contains("Merge"))  
                Console.WriteLine("The collection contains {0} pipeline component", pInfos[0].Name);  
            else  
                Console.WriteLine("The collection does not contain {0} pipeline component", pInfos[0].Name);  
        }  
    }  
}  
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 pInfos As PipelineComponentInfos =  app.PipelineComponentInfos   

            ' Search the collection by name.  
            If pInfos.Contains("Merge") Then  
                Console.WriteLine("The collection contains {0} pipeline component", pInfos(0).Name)  
            Else   
                Console.WriteLine("The collection does not contain {0} pipeline component", pInfos(0).Name)  
            End If  
        End Sub  
    End Class  
End Namespace  

샘플 출력:

컬렉션에 Merge 파이프라인 구성 요소가 포함되어 있습니다.

적용 대상