ProfileSettingsCollection.IndexOf(String) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
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"))