Langue

RuleSettingsCollection.IndexOf(String) Méthode

Définition

Recherche l’index d’un RuleSettings objet dans la collection avec le nom spécifié.

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 RuleSettings objet dans la collection.

Retours

Index d’un RuleSettings objet dans la collection portant le nom spécifié.

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 'All Errors Default' RuleSettings in the Rules collection property.
Console.WriteLine("EventMappings index for 'All Errors Default': {0}.",
    healthMonitoringSection.Rules.IndexOf("All Errors Default"));
' Get the index of the 'All Errors Default' RuleSettings in the Rules collection property.
Console.WriteLine("EventMappings index for 'All Errors Default': {0}.", _
    healthMonitoringSection.Rules.IndexOf("All Errors Default"))

Remarques

Retourne -1 si un RuleSettings objet portant le nom spécifié n’est pas dans la collection.

S’applique à

Voir aussi