LogProviderInfos.Item[Object] プロパティ

定義

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

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

パラメーター

index
Object

コレクションから返されるオブジェクトの名前、説明、ID、またはインデックスです。

プロパティ値

LogProviderInfo

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

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

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

namespace LogProvInfoProperties  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
        Application app = new Application();  
        LogProviderInfos infos = app.LogProviderInfos;  

        //Using the Item method syntax of [x], obtain the first entry.  
        LogProviderInfo lInfo = infos[0];  
        String nameOfFirstItem = infos[0].Name;  

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

Namespace LogProvInfoProperties  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
        Dim app As Application =  New Application()   
        Dim infos As LogProviderInfos =  app.LogProviderInfos   

        'Using the Item method syntax of [x], obtain the first entry.  
        Dim lInfo As LogProviderInfo =  infos(0)   
        Dim nameOfFirstItem As String =  infos(0).Name   

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

サンプル出力:

The ID of the first log provider is: {59B2C6A5-663F-4C20-8863-C83F9B72E2EB}

The Name of the first log provider is: SSIS log provider for Text files

注釈

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

適用対象