DataTypeInfos.Item[Object] 属性   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从集合返回一个 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 对象。
示例
下面的代码示例使用两种方法从集合中检索项。 第一种方法使用 dataInfos[0] 语法检索位于集合的第一位置的整个对象,并将其放置在对象中 dtInfo 。 完成后,可以像往常一样从 dtInfo 对象中检索所有属性。 第二种方法演示如何从集合中的第一个对象检索特定属性。
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
第一个任务的 TypeName 为: float
注解
如果对方法的true调用Contains返回,则可以使用语法DataTupeInfos[index]访问集合中的指定元素。 
              Contains如果该方法返回false,此属性将引发异常。 在 C# 中,此属性是 DataTypeInfos 类的索引器。