Sprache

LogProviders.Item[Object] Eigenschaft

Definition

Ruft ein LogProvider Objekt aus der Auflistung ab.

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

Parameter

index
Object

Name, Beschreibung, ID oder Index des Objekts, das aus der Sammlung zurückgegeben werden soll.

Eigenschaftswert

Ein LogProvider Objekt aus der Sammlung.

Beispiele

Das folgende Codebeispiel ruft ein Element aus der Sammlung mithilfe von zwei Methoden ab. Die erste Methode verwendet die Syntax logProvs[0] , um das gesamte Objekt an der ersten Position der Sammlung abzurufen und im logProv Objekt zu platzieren. Du kannst jetzt wie üblich alle Eigenschaften aus dem logProv Objekt abrufen. Die zweite Methode zeigt, wie man eine bestimmte Eigenschaft aus dem ersten Objekt der Sammlung abruft.

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

namespace LogProviders_Tests  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            // The package is one of the SSIS Samples.  
            string mySample = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx";  

            // Create the Application, and load the sample.  
            Application app = new Application();  
            Package pkg = app.LoadPackage(mySample, null);  
            LogProviders logProvs = pkg.LogProviders;  

            //Using the Item method syntax of [x], obtain the  
            // first entry and a name.  
            LogProvider logProv = logProvs[0];  
            String nameOfFirstItem = logProvs[0].Name;  

            //Print the name of the log provider object   
           // located at position [0].  
            Console.WriteLine("The ID of the first connection info is: {0}", logProv.ID);  
            Console.WriteLine("The Name of the first connection info is: {0}", nameOfFirstItem);  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  

Namespace LogProviders_Tests  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            ' The package is one of the SSIS Samples.  
            Dim mySample As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx"   

            ' Create the Application, and load the sample.  
            Dim app As Application =  New Application()   
            Dim pkg As Package =  app.LoadPackage(mySample,Nothing)   
            Dim logProvs As LogProviders =  pkg.LogProviders   

            'Using the Item method syntax of [x], obtain the  
            ' first entry and a name.  
            Dim logProv As LogProvider =  logProvs(0)   
            Dim nameOfFirstItem As String =  logProvs(0).Name   

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

Beispielausgabe:

Die ID der ersten Verbindungsinformationen lautet: {1E107E39-DB79-4F02-B8A7-61D88F2DEF63}

Der Name der ersten Verbindungsinformation lautet: SSIS-Log-Anbieter für Textdateien

Hinweise

Wenn der Aufruf der Methode Contains zurückkehrt true, können Sie das angegebene Element in der Sammlung mithilfe der Syntax LogProviders[index]abrufen. Wenn die zurückgibtContains, false wirft diese Eigenschaft eine Ausnahme. In C# ist diese Eigenschaft der Indexer für die LogProviders Klasse.

Gilt für: