CodeDirectiveCollection.IndexOf(CodeDirective) 메서드

정의

컬렉션에 있는 경우 지정된 CodeDirective 개체의 컬렉션에 있는 인덱스를 가져옵니다.

public:
 int IndexOf(System::CodeDom::CodeDirective ^ value);
public int IndexOf(System.CodeDom.CodeDirective value);
member this.IndexOf : System.CodeDom.CodeDirective -> int
Public Function IndexOf (value As CodeDirective) As Integer

매개 변수

value
CodeDirective

CodeDirective 컬렉션에서 찾을 개체입니다.

반품

지정된 개체의 컬렉션에 있는 인덱스 위치입니다(있는 경우). 그렇지 않으면 -1입니다.

예제

다음 코드 예제에서는 메서드를 IndexOf 사용하여 지정된 CodeDirective 개체의 컬렉션에서 인덱스 가져오기를 보여 있습니다. 이 예제는 클래스에 제공된 더 큰 예제의 CodeDirectiveCollection 일부입니다.

// Tests for the presence of a CodeDirective in the
// collection, and retrieves its index if it is found.
CodeDirective testDirective = new CodeRegionDirective(CodeRegionMode.Start, "Region1");
int itemIndex = -1;
if (collection.Contains(testDirective))
    itemIndex = collection.IndexOf(testDirective);
' Tests for the presence of a CodeDirective in the 
' collection, and retrieves its index if it is found.
Dim testDirective = New CodeRegionDirective(CodeRegionMode.Start, "Region1")
Dim itemIndex As Integer = -1
If collection.Contains(testDirective) Then
    itemIndex = collection.IndexOf(testDirective)
End If

적용 대상