LogProviders.Item[Object] プロパティ

定義

コレクションから LogProvider オブジェクトを取得します。

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

パラメーター

index
Object

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

プロパティ値

LogProvider

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

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

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

namespace LogProviders_Tests  
{  
    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);  
            LogProviders logProvs = pkg.LogProviders;  

            //Using the Item method syntax of [x], obtain the  
            // first entry and a name.  
            LogProvider logProv = logProvs[0];  
            String nameOfFirstItem = logProvs[0].Name;  

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

Namespace LogProviders_Tests  
    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)   
            Dim logProvs As LogProviders =  pkg.LogProviders   

            'Using the Item method syntax of [x], obtain the  
            ' first entry and a name.  
            Dim logProv As LogProvider =  logProvs(0)   
            Dim nameOfFirstItem As String =  logProvs(0).Name   

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

サンプル出力:

The ID of the first connection info is: {1E107E39-DB79-4F02-B8A7-61D88F2DEF63}

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

注釈

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

適用対象