DataTypeInfos.Item[Object] プロパティ

定義

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

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

パラメーター

index
Object

コレクションから取得する DataTypeInfo オブジェクトのインデックスです。

プロパティ値

DataTypeInfo オブジェクト。

次のコード サンプルでは、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

注釈

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

適用対象