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

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

Beispiele

Das folgende Codebeispiel zeigt, wie die IndexOf Methode verwendet wird. 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:

Weitere Informationen