Właściwość LogProviders.Item
Zwraca LogProvider obiekt z kolekcja.
Przestrzeń nazw: Microsoft.SqlServer.Dts.Runtime
Zestaw: Microsoft.SqlServer.ManagedDTS (w Microsoft.SqlServer.ManagedDTS.dll)
Składnia
'Deklaracja
Public ReadOnly Default Property Item ( _
index As Object _
) As LogProvider
Get
'Użycie
Dim instance As LogProviders
Dim index As Object
Dim value As LogProvider
value = instance(index)
public LogProvider this[
Object index
] { get; }
public:
property LogProvider^ default[Object^ index] {
LogProvider^ get (Object^ index);
}
member Item : LogProvider
Język JScript obsługuje używanie indeksowanych właściwości, ale nie obsługuje deklarowania nowych.
Parametry
- index
Typ: System.Object
Nazwa, opis, identyfikator lub indeks obiektu z kolekcja.
Wartość właściwości
Typ: Microsoft.SqlServer.Dts.Runtime.LogProvider
A LogProvider obiektu.
Uwagi
Jeśli wywołanie Contains Metoda zwraca true, określonego elementu kolekcja można uzyskać dostęp za pomocą składni LogProviders[index].Jeśli Contains zwraca false, ta właściwość zgłasza wyjątek.W języku C#, ta właściwość jest indeksowanie dla LogProviders klasy
Przykłady
Poniższy przykład kodu pobiera element z kolekcja przy użyciu dwóch metod.Pierwszy metoda używa logProvs[0] składni, aby pobrać cały obiekt znajdujący się na pierwszym miejscu gromadzenia i umieścić go w logProv obiektu.Można teraz pobrać wszystkie właściwości z logProv obiektu w zwykły sposób.Druga metoda ilustruje sposób pobrać właściwość określonym pierwszy obiekt kolekcja.
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
Przykładowe dane wyjściowe:
The ID of the first connection info is: {1E107E39-DB79-4F02-B8A7-61D88F2DEF63}
The Name of the first connection info is: SSIS log provider for Text files