ProfileSettingsCollection.IndexOf(String) Метод

Определение

Возвращает индекс указанного объекта ProfileSettings.

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

Параметры

name
String

Имя объекта ProfileSettings в коллекции.

Возвращаемое значение

Индекс заданного объекта ProfileSettings в коллекции или -1, если объект не найден.

Примеры

В следующем примере кода показано применение метода IndexOf. Этот пример входит в состав более крупного примера использования класса HealthMonitoringSection.

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

Применяется к

См. также раздел