LogEntryInfos.Item[Object] プロパティ

定義

コレクションから LogEntryInfo オブジェクトを取得します。 このプロパティは Item[Object] クラスの既定のインデクサー LogEntryInfos であり、LogEntryInfos[..] を使用して値を検索できます。 構文。

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

パラメーター

index
Object

コレクション内で検索する LogEntryInfo オブジェクトの名前、説明、ID、またはインデックスです。

プロパティ値

コレクションからの LogEntryInfo オブジェクトです。

次のコード例では、2 つのメソッドを使用して、コレクションから項目を取得します。 最初のメソッドでは、構文を logInfos[0] 使用して、コレクションの最初の位置にあるオブジェクト全体を取得し、オブジェクトに logInfos 配置します。 これによって、logInfo オブジェクトのすべてのプロパティを通常どおり取得できるようになります。 2 番目のメソッドでは、コレクションの最初のオブジェクトから特定のプロパティを取得します。

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  

サンプル出力:

The ID of the first log entry is: {D5BD104A-9504-4087-A742-44B2BD90A09D}

The Name of the first log entry is: Diagnostic

注釈

メソッドの呼び出しが Contains 返される true場合は、構文 LogEntryInfo[index]を使用してコレクション内の指定された要素にアクセスできます。 Contains から false が返される場合、このプロパティは例外をスローします。

C# では、このプロパティは LogEntryInfos クラスのインデクサーです。

適用対象