Aracılığıyla paylaş


Executables.Contains Yöntemi

Döndürür bir Boole koleksiyon öğeleri dizine parametre olarak kullanarak erişilebilir olup olmadığını gösterir.

Ad Alanı:  Microsoft.SqlServer.Dts.Runtime
Derleme:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS içinde.dll)

Sözdizimi

'Bildirim
Public Function Contains ( _
    index As Object _
) As Boolean
'Kullanım
Dim instance As Executables
Dim index As Object
Dim returnValue As Boolean

returnValue = instance.Contains(index)
public bool Contains(
    Object index
)
public:
bool Contains(
    Object^ index
)
member Contains : 
        index:Object -> bool 
public function Contains(
    index : Object
) : boolean

Parametreler

Dönüş Değeri

Tür: System.Boolean
doğru sözdizimini kullanarak bir öğe alırsanız Executables[index]; yanlış dizin öğeleri almak için kullanılamaz, Executables koleksiyon.

Örnekler

Aşağıdaki kod örneği bir yürütülebilir dosya Ekle toplu görev ekler, sonra da kullandığı Contains doğrulama paket en az bir yürütülebilir dosyanın varlığını denetle

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

namespace Executables_API
{
        class Program
        {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            Executable exec = pkg.Executables.Add("STOCK:BulkInsertTask");

            // Obtain the collection.
            Executables pgkExecs = pkg.Executables;
            foreach (Executable eachExec in pgkExecs)
            {
                TaskHost th = exec as TaskHost;
                Console.WriteLine("Executable creation name is: {0}", th.CreationName);
            }

            // Show use of Contains.
            if (pgkExecs.Contains(0))
            {
                Console.WriteLine("Contains returned true");
            }
            else
            {
                Console.WriteLine("Contains returned false");
            }
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
 
Namespace Executables_API
        Class Program
        Shared  Sub Main(ByVal args() As String)
            Dim pkg As Package =  New Package() 
            Dim exec As Executable =  pkg.Executables.Add("STOCK:BulkInsertTask") 
 
            ' Obtain the collection.
            Dim pgkExecs As Executables =  pkg.Executables 
            Dim eachExec As Executable
            For Each eachExec In pgkExecs
                Dim th As TaskHost =  exec as TaskHost 
                Console.WriteLine("Executable creation name is: {0}", th.CreationName)
            Next
 
            ' Show use of Contains.
            If pgkExecs.Contains(0) Then
                Console.WriteLine("Contains returned true")
            Else 
                Console.WriteLine("Contains returned false")
            End If
        End Sub
        End Class
End Namespace

Örnek Çıktı:

Executable creation name is: Microsoft.SqlServer.Dts.Tasks.BulkInsertTask.BulkInsertTask, Microsoft.SqlServer.BulkInsertTask, Version=10.0.000.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91

Contains returned true