Właściwość LogEntryInfos.Item
Zwraca LogEntryInfo obiekt z kolekcja.Item Właściwość jest indeksatora domyślne dla LogEntryInfos klasy i umożliwia wyszukiwanie wartości za pomocą LogEntryInfos[…] składni.
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 LogEntryInfo
Get
'Użycie
Dim instance As LogEntryInfos
Dim index As Object
Dim value As LogEntryInfo
value = instance(index)
public LogEntryInfo this[
Object index
] { get; }
public:
property LogEntryInfo^ default[Object^ index] {
LogEntryInfo^ get (Object^ index);
}
member Item : LogEntryInfo
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 LogEntryInfo obiekt, aby odnaleźć kolekcja.
Wartość właściwości
Typ: Microsoft.SqlServer.Dts.Runtime.LogEntryInfo
A LogEntryInfo obiektu.
Uwagi
Jeśli wywołanie Contains Metoda zwraca true, określonego elementu kolekcja można uzyskać dostęp za pomocą składni LogEntryInfo[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 LogEntryInfos klasy
Przykłady
Poniższy przykład kodu pobiera element z kolekcja, używając dwóch metod.Pierwszy metoda używa logInfos[0] składni, aby pobrać cały obiekt znajdujący się na pierwszym miejscu gromadzenia i umieścić go w logInfos obiektu.Można teraz pobrać wszystkie właściwości z logInfo 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 LogEntryInfosTest
{
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);
// Get the LogEntryInfos from the package.
LogEntryInfos logInfos = pkg.LogEntryInfos;
//Using the Item method syntax of [x], obtain the
//first entry. Also, using the [x] syntax, retrieve a
// specific property, the Name.
LogEntryInfo logInfo = logInfos[0];
String nameOfFirstItem = logInfos[0].Name;
//Print the name of the logEntryInfo oabject located
//at position [0].
Console.WriteLine("The ID of the first log entry is: {0}", logInfo.ID);
Console.WriteLine("The Name of the first log entry is: {0}", nameOfFirstItem);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace LogEnTryInfosTest
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)
' Get the LogEntryInfos from the package.
Dim logInfos As LogEnTryInfos = pkg.LogEnTryInfos
'Using the Item method syntax of [x], obtain the
'first entry. Also, using the [x] syntax, retrieve a
' specific property, the Name.
Dim logInfo As LogEnTryInfo = logInfos(0)
Dim nameOfFirstItem As String = logInfos(0).Name
'Print the name of the logEntryInfo oabject located
'at position [0].
Console.WriteLine("The ID of the first log entry is: {0}", logInfo.ID)
Console.WriteLine("The Name of the first log entry is: {0}", nameOfFirstItem)
End Sub
End Class
End Namespace
Przykładowe dane wyjściowe:
Identyfikator pierwszy wpis dziennika jest: {D5BD104A-9504-4087-A742-44B2BD90A09D}
Nazwa pierwszego wpisu dziennika jest: Diagnostyka