ProfileSettingsCollection.IndexOf(String) Methode

Definition

Gibt den Index des angegebenen ProfileSettings-Objekts zurück.

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

Parameter

name
String

Der Name eines ProfileSettings-Objekts in der Auflistung.

Gibt zurück

Int32

Der Index des angegebenen ProfileSettings-Objekts oder -1, wenn das Objekt nicht in der Auflistung gefunden wird.

Beispiele

Im folgenden Codebeispiel wird die Verwendung der IndexOf-Methode veranschaulicht. Dieses Codebeispiel ist Teil eines größeren Beispiels, das für die HealthMonitoringSection Klasse bereitgestellt wird.

// Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.",
    healthMonitoringSection.Profiles.IndexOf("Default"));
' Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.", _
    healthMonitoringSection.Profiles.IndexOf("Default"))

Gilt für

Siehe auch