DataTypeInfos.Item プロパティ

DataTypeInfo オブジェクトをコレクションから返します。

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

構文

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

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

パラメーター

  • index
    型: System.Object
    コレクションから取得する DataTypeInfo オブジェクトのインデックスです。

プロパティ値

型: Microsoft.SqlServer.Dts.Runtime.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 TypeEnumName of the first item is: DT_R4

The TypeName of the first task is: float

関連項目

参照

DataTypeInfos クラス

Microsoft.SqlServer.Dts.Runtime 名前空間