RuleSettingsCollection.IndexOf(String) Metodo

Definizione

Trova l'indice di un RuleSettings oggetto nell'insieme con il nome specificato.

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

Parametri

name
String

Nome di un RuleSettings oggetto nell'insieme.

Valori restituiti

Indice di un RuleSettings oggetto nell'insieme con il nome specificato.

Esempio

Nell'esempio di codice seguente viene illustrato come usare il IndexOf metodo . Questo esempio di codice fa parte di un esempio più ampio fornito per 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"))

Commenti

Restituisce -1 se un RuleSettings oggetto con il nome specificato non è presente nell'insieme.

Si applica a

Vedi anche