Item プロパティ

LogProviderInfo オブジェクトをコレクションから返します。Item プロパティは、LogProviderInfos クラスの既定のインデクサとなります。このプロパティを使用すると、LogProviderInfos[…] 構文による値の参照ができます。

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Public ReadOnly Default Property Item ( _
    index As Object _
) As LogProviderInfo
    Get
'使用
Dim instance As LogProviderInfos
Dim index As Object
Dim value As LogProviderInfo

value = instance(index)
public LogProviderInfo this[
    Object index
] { get; }
public:
property LogProviderInfo^ default[Object^ index] {
    LogProviderInfo^ get (Object^ index);
}
member Item : LogProviderInfo
JScript はインデックス化されたプロパティの使用をサポートしていますが、新規の宣言はサポートしていません。

パラメーター

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

プロパティ値

型: Microsoft.SqlServer.Dts.Runtime. . :: . .LogProviderInfo
LogProviderInfo オブジェクトです。

説明

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

使用例

次のコード例では、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