PipelineComponentInfos.Contains Method (Object)


Returns a Boolean that indicates if the items in the collection can be accessed using indexing without throwing an exception.

Namespace:   Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

public bool Contains(
	object index


Type: System.Object

The name, identity, ID, or index of the PipelineComponentInfo object to locate in the collection

Return Value

Type: System.Boolean

A Boolean that indicates whether the collection can be accessed by name, identity, ID, or index. A value of true indicates that the collection can be accessed by using the syntax PipelineComponentInfos [index]. A value of false indicates that indexing cannot be used to retrieve items from the PipelineComponentInfos collection; using this property throws an exception.

The following code sample uses Contains method to determine if a pipeline component with the name "Merge" is in the collection. The method returns a 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);
                Console.WriteLine("The collection does not contain {0} pipeline component", pInfos[0].Name);

Sample Output:

The collection contains Merge pipeline component

Return to top