DataTypeInfos.Item[Object] Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Retourne un DataTypeInfo objet de la collection.
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
Paramètres
- index
- Object
Index de l’objet DataTypeInfo à récupérer à partir de la collection.
Valeur de propriété
Objet DataTypeInfo.
Exemples
L’exemple de code suivant récupère un élément de la collection en utilisant deux méthodes. La première méthode utilise la dataInfos[0] syntaxe pour récupérer l’objet entier situé à la première position de la collection et le placer dans l’objet dtInfo . Une fois cela fait, vous pouvez récupérer toutes les propriétés de l’objet dtInfo comme d’habitude. La seconde méthode démontre comment récupérer une propriété spécifique à partir du premier objet de la collection.
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
Exemple de sortie :
Le TypeEnum Name du premier élément est : DT_R4
Le TypeName de la première tâche est : float
Remarques
Si l’appel à la Contains méthode retourne true, vous pouvez accéder à l’élément spécifié dans la collection en utilisant la syntaxe DataTupeInfos[index]. Si la Contains méthode retourne false, cette propriété lance une exception. En C#, cette propriété est l’indexeur de la DataTypeInfos classe.