Langue

ProfileSettingsCollection.IndexOf(String) Méthode

Définition

Retourne l’index de l’objet spécifié ProfileSettings .

public:
 int IndexOf(System::String ^ name);
public int IndexOf(string name);
member this.IndexOf : string -> int
Public Function IndexOf (name As String) As Integer

Paramètres

name
String

Nom d’un ProfileSettings objet dans la collection.

Retours

Index de l’objet spécifié ProfileSettings ou -1 si l’objet est introuvable dans la collection.

Exemples

L’exemple de code suivant montre comment utiliser la IndexOf méthode. Cet exemple de code fait partie d’un exemple plus grand fourni pour la HealthMonitoringSection classe.

// Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.",
    healthMonitoringSection.Profiles.IndexOf("Default"));
' Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.", _
    healthMonitoringSection.Profiles.IndexOf("Default"))

S’applique à

Voir aussi