LogEntryInfos.Item Property
Returns a LogEntryInfo object from the collection. The Item property is the default indexer for LogEntryInfos class, and allows the lookup of values using the LogEntryInfos[…]
syntax.
Espacio de nombres: Microsoft.SqlServer.Dts.Runtime
Ensamblado: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)
Sintaxis
'Declaración
Public ReadOnly Default Property Item ( _
index As Object _
) As LogEntryInfo
public LogEntryInfo this [
Object index
] { get; }
public:
property LogEntryInfo^ default [Object^] {
LogEntryInfo^ get (Object^ index);
}
/** @property */
public LogEntryInfo get_Item (Object index)
Parámetros
- index
The name, description, ID, or index of the LogEntryInfo object to locate in the collection.
Valor de propiedad
A LogEntryInfo object.
Notas
If the call to Contains method returns true, you can access the specified element in the collection by using the syntax LogEntryInfo[index]
. If the Contains returns false, this property throws an exception.
In C#, this property is the indexer for the LogEntryInfos class.
Ejemplo
The following code example retrieves an item from the collection using two methods. The first method uses the logInfos[0]
syntax to retrieve the entire object located in the first position of the collection and place it in the logInfos
object. You can now retrieve all properties from the logInfo
object as usual. The second method demonstrates how to retrieve a specific property from the first object in the collection.
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\90\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\90\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
Sample Output:
The ID of the first log entry is: {D5BD104A-9504-4087-A742-44B2BD90A09D}
The Name of the first log entry is: Diagnostic
Seguridad para subprocesos
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Plataformas
Plataformas de desarrollo
Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.
Plataformas de destino
Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.
Vea también
Referencia
LogEntryInfos Class
LogEntryInfos Members
Microsoft.SqlServer.Dts.Runtime Namespace