Bagikan melalui


PipelineComponentInfos.Contains(Object) Metode

Definisi

Mengembalikan Boolean yang menunjukkan apakah item dalam koleksi dapat diakses menggunakan pengindeksan tanpa melemparkan pengecualian.

public:
 bool Contains(System::Object ^ index);
public bool Contains (object index);
member this.Contains : obj -> bool
Public Function Contains (index As Object) As Boolean

Parameter

index
Object

Nama, identitas, ID, atau indeks PipelineComponentInfo objek untuk ditemukan dalam koleksi

Mengembalikan

Boolean yang menunjukkan apakah koleksi dapat diakses berdasarkan nama, identitas, ID, atau indeks. Nilai true menunjukkan bahwa koleksi dapat diakses dengan menggunakan sintaks PipelineComponentInfos [index]. Nilai false menunjukkan bahwa pengindeksan tidak dapat digunakan untuk mengambil item dari PipelineComponentInfos koleksi; menggunakan properti ini melemparkan pengecualian.

Contoh

Sampel kode berikut menggunakan Contains metode untuk menentukan apakah komponen alur dengan nama "Gabungkan" ada dalam koleksi. Metode mengembalikan 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  

Contoh Output:

Koleksi berisi komponen Alur Penggabungan

Berlaku untuk