LogProviderInfos.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.
Obtient un LogProviderInfo objet de la collection. Cette Item[Object] propriété est l’indexeur par défaut pour LogProviderInfos la classe et permet la recherche de valeurs via le LogProviderInfos[...] .
public:
property Microsoft::SqlServer::Dts::Runtime::LogProviderInfo ^ default[System::Object ^] { Microsoft::SqlServer::Dts::Runtime::LogProviderInfo ^ get(System::Object ^ index); };
public Microsoft.SqlServer.Dts.Runtime.LogProviderInfo this[object index] { get; }
member this.Item(obj) : Microsoft.SqlServer.Dts.Runtime.LogProviderInfo
Default Public ReadOnly Property Item(index As Object) As LogProviderInfo
Paramètres
- index
- Object
Le nom, la description, l’ID ou l’index de l’objet à retourner de la collection.
Valeur de propriété
Un LogProviderInfo objet de la collection.
Exemples
L’exemple de code suivant permet de récupérer un élément de la collection en utilisant deux méthodes. La première méthode utilise la infos[0] syntaxe pour récupérer l’objet entier situé à la première position de la collection, puis le placer dans l’objet lInfo . Vous pouvez désormais récupérer toutes les propriétés de l’objet lInfo 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 LogProvInfoProperties
{
class Program
{
static void Main(string[] args)
{
Application app = new Application();
LogProviderInfos infos = app.LogProviderInfos;
//Using the Item method syntax of [x], obtain the first entry.
LogProviderInfo lInfo = infos[0];
String nameOfFirstItem = infos[0].Name;
//Print the name of the log provider object located at position [0].
Console.WriteLine("The ID of the first log provider is: {0}", lInfo.ID);
Console.WriteLine("The Name of the first log provider is: {0}", nameOfFirstItem);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace LogProvInfoProperties
Class Program
Shared Sub Main(ByVal args() As String)
Dim app As Application = New Application()
Dim infos As LogProviderInfos = app.LogProviderInfos
'Using the Item method syntax of [x], obtain the first entry.
Dim lInfo As LogProviderInfo = infos(0)
Dim nameOfFirstItem As String = infos(0).Name
'Print the name of the log provider object located at position [0].
Console.WriteLine("The ID of the first log provider is: {0}", lInfo.ID)
Console.WriteLine("The Name of the first log provider is: {0}", nameOfFirstItem)
End Sub
End Class
End Namespace
Exemple de sortie :
L’identifiant du premier fournisseur de journal est : {59B2C6A5-663F-4C20-8863-C83F9B72E2EB}
Le nom du premier fournisseur de journal est : fournisseur SSIS de journaux pour fichiers texte
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 LogProviderInfos[index]. Cependant, si la Contains méthode retourne false, cette propriété lance une exception. En C#, cette propriété est l’indexeur de la LogProviderInfos classe.