Udostępnij przez


RuleSettingsCollection.IndexOf(String) Metoda

Definicja

Znajduje indeks RuleSettings obiektu w kolekcji o określonej nazwie.

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

Parametry

name
String

Nazwa RuleSettings obiektu w kolekcji.

Zwraca

Indeks RuleSettings obiektu w kolekcji o określonej nazwie.

Przykłady

W poniższym przykładzie kodu pokazano, jak używać IndexOf metody . Ten przykład kodu jest częścią większego przykładu udostępnionego HealthMonitoringSection dla klasy .

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

Uwagi

Zwraca wartość -1, jeśli RuleSettings obiekt o określonej nazwie nie znajduje się w kolekcji.

Dotyczy

Zobacz też