Sdílet prostřednictvím


RuleSettingsCollection.IndexOf(String) Metoda

Definice

Vyhledá index objektu RuleSettings v kolekci se zadaným názvem.

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

Název objektu RuleSettings v kolekci.

Návraty

Index objektu RuleSettings v kolekci se zadaným názvem.

Příklady

Následující příklad kódu ukazuje, jak použít metodu IndexOf . Tento příklad kódu je součástí většího příkladu HealthMonitoringSection pro třídu.

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

Poznámky

Vrátí hodnotu -1, RuleSettings pokud objekt se zadaným názvem není v kolekci.

Platí pro

Viz také