言語

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  

出力例:

最初のアイテムのTypeEnumNameは以下の通りです:DT_R4

最初のタスクのタイプ名は:floatです

注釈

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

適用対象