DBProviderInfos.Item[Object] プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
DBProviderInfo オブジェクトをコレクションから返します。
public:
property Microsoft::SqlServer::Dts::Runtime::DBProviderInfo ^ default[System::Object ^] { Microsoft::SqlServer::Dts::Runtime::DBProviderInfo ^ get(System::Object ^ index); };
public Microsoft.SqlServer.Dts.Runtime.DBProviderInfo this[object index] { get; }
member this.Item(obj) : Microsoft.SqlServer.Dts.Runtime.DBProviderInfo
Default Public ReadOnly Property Item(index As Object) As DBProviderInfo
パラメーター
- index
- Object
返す DBProviderInfo オブジェクトの名前、説明、またはインデックスです。
プロパティ値
DBProviderInfos オブジェクト。
例
次のコード例では、2 つのメソッドを使用して、コレクションから項目を取得します。 最初のメソッドでは、構文を dbprovInfos[0]
使用して、コレクションの最初の位置にあるオブジェクト全体を取得し、オブジェクトに dbInfo
配置します。 これによって、dbInfo
オブジェクトのすべてのプロパティを通常どおり取得できるようになります。 2 番目のメソッドでは、コレクションの最初のオブジェクトから特定のプロパティを取得します。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace DBProvInfos_GetEnum
{
class Program
{
static void Main(string[] args)
{
Application app = new Application();
DBProviderInfos dbprovInfos = app.DBProviderInfos;
//Using the Item method syntax of [x], obtain the first entry.
DBProviderInfo dbInfo = dbprovInfos[0];
String nameOfFirstItem = dbprovInfos[0].Name;
//Print the name of the log provider object located at position [0].
Console.WriteLine("The db provider type of the first provider is: {0}", dbInfo.ProviderType);
Console.WriteLine("The Name of the first database provider is: {0}", nameOfFirstItem);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace DBProvInfos_GetEnum
Class Program
Shared Sub Main(ByVal args() As String)
Dim app As Application = New Application()
Dim dbprovInfos As DBProviderInfos = app.DBProviderInfos
'Using the Item method syntax of [x], obtain the first entry.
Dim dbInfo As DBProviderInfo = dbprovInfos(0)
Dim nameOfFirstItem As String = dbprovInfos(0).Name
'Print the name of the log provider object located at position [0].
Console.WriteLine("The db provider type of the first provider is: {0}", dbInfo.ProviderType)
Console.WriteLine("The Name of the first database provider is: {0}", nameOfFirstItem)
End Sub
End Class
End Namespace
サンプル出力:
The db provider type of the first provider is: OleDb
The Name of the first database provider is: MediaCatalogDB OLE DB Provider
注釈
メソッドの呼び出しが Contains 返される true
場合は、構文 DBProviderInfos[index]
を使用してコレクション内の指定された要素にアクセスできます。 戻り値が返されたContainsfalse
場合、このプロパティは例外をスローします。 C# では、このプロパティは DBProviderInfos クラスのインデクサーです。