Share via


RuleSettingsCollection.IndexOf(String) Méthode

Définition

Recherche l'index de l'objet RuleSettings portant le nom spécifié dans la collection.

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

Retours

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

Exemples

L'exemple de code suivant montre comment utiliser la méthode IndexOf. 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