다음을 통해 공유


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 개체의 이름입니다.

반환

Int32

지정된 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"))

적용 대상

추가 정보