Share via


RuleSettingsCollection.IndexOf(String) Método

Definición

Busca en la colección el índice de un objeto RuleSettings con el nombre especificado.

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

Parámetros

name
String

Nombre de un objeto RuleSettings de la colección.

Devoluciones

Índice de un objeto RuleSettings de la colección con el nombre especificado.

Ejemplos

En el ejemplo de código siguiente, se muestra cómo se utiliza el método IndexOf. Este ejemplo de código es parte de un ejemplo mayor proporcionado para la clase HealthMonitoringSection.

// 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"))

Comentarios

Devuelve -1 si un RuleSettings objeto con el nombre especificado no está en la colección.

Se aplica a

Consulte también