DataTypeInfo オブジェクトをコレクションから返します。
名前空間: Microsoft.SqlServer.Dts.Runtime
アセンブリ: Microsoft.SqlServer.ManagedDTS (microsoft.sqlserver.manageddts.dll 内)
構文
'宣言
Public ReadOnly Default Property Item ( _
index As Object _
) As DataTypeInfo
public DataTypeInfo this [
Object index
] { get; }
public:
property DataTypeInfo^ default [Object^] {
DataTypeInfo^ get (Object^ index);
}
/** @property */
public DataTypeInfo get_Item (Object index)
パラメータ
- index
コレクションから取得する DataTypeInfo オブジェクトのインデックスです。
プロパティ値
DataTypeInfo オブジェクトです。
解説
Contains メソッドの呼び出しが true を返す場合、DataTupeInfos[index] 構文を使用することにより、コレクション内の指定した要素にアクセスできます。Contains メソッドが false を返す場合、このプロパティは例外をスローします。C# の場合、このプロパティは DataTypeInfos クラスのインデクサとなります。
使用例
次のコード サンプルでは、2 つのメソッドを使用して、コレクションから項目を取得します。最初のメソッドでは、dataInfos[0] 構文を使用して、コレクションの先頭に格納されたオブジェクト全体を取得し、dtInfo オブジェクトに格納します。これによって、dtInfo オブジェクトのすべてのプロパティを通常どおり取得できるようになります。2 番目のメソッドでは、コレクションの最初のオブジェクトから特定のプロパティを取得します。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace DataTypeInfos_GetEnum_Current
{
class Program
{
static void Main(string[] args)
{
//Create the DataTypeInfos collection.
DataTypeInfos dataInfos = new Application().DataTypeInfos;
//Using the Item method syntax of [x], obtain the first entry.
DataTypeInfo dtInfo = dataInfos[0];
String nameOfFirstItem = dataInfos[0].TypeName;
//Print the name of the task object located at position [0].
Console.WriteLine("The TypeEnumName of the first item is: {0}", dtInfo.TypeEnumName);
Console.WriteLine("The TypeName of the first task is: {0}", nameOfFirstItem);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace DataTypeInfos_GetEnum_Current
Class Program
Shared Sub Main(ByVal args() As String)
'Create the DataTypeInfos collection.
Dim dataInfos As DataTypeInfos = New Application().DataTypeInfos
'Using the Item method syntax of [x], obtain the first entry.
Dim dtInfo As DataTypeInfo = dataInfos(0)
Dim nameOfFirstItem As String = dataInfos(0).TypeName
'Print the name of the task object located at position [0].
Console.WriteLine("The TypeEnumName of the first item is: {0}", dtInfo.TypeEnumName)
Console.WriteLine("The TypeName of the first task is: {0}", nameOfFirstItem)
End Sub
End Class
End Namespace
サンプルの出力 :
The name of the first variable is: CancelEvent
The name of the first variable is: CancelEvent
スレッド セーフ
この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
開発プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
対象プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
参照
関連項目
DataTypeInfos Class
DataTypeInfos Members
Microsoft.SqlServer.Dts.Runtime Namespace