ProfileSettingsCollection.IndexOf(String) Metod

Definition

Returnerar indexet för det angivna ProfileSettings objektet.

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

Parametrar

name
String

Namnet på ett ProfileSettings objekt i samlingen.

Returer

Indexet för det angivna ProfileSettings objektet eller -1 om objektet inte hittas i samlingen.

Exempel

I följande kodexempel visas hur metoden IndexOf används. Det här kodexemplet är en del av ett större exempel för HealthMonitoringSection klassen.

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

Gäller för

Se även