CodeStatementCollection.IndexOf(CodeStatement) 메서드

정의

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

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

매개 변수

value
CodeStatement

CodeStatement 컬렉션에서 찾을 위치입니다.

반품

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

예제

다음 예제에서는 특정 CodeStatement 항목이 있는지 검색하고 메서드를 IndexOf 사용하여 검색된 인덱스 값을 검색합니다.

// Tests for the presence of a CodeStatement in the
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if( collection.Contains( testStatement ) )
    itemIndex = collection.IndexOf( testStatement );
' Tests for the presence of a CodeStatement in the 
' collection, and retrieves its index if it is found.
Dim itemIndex As Integer = -1
If collection.Contains(testStatement) Then
    itemIndex = collection.IndexOf(testStatement)
End If

적용 대상

추가 정보