다음을 통해 공유


CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) 메서드

정의

CodeTypeDeclaration에 지정된 CodeTypeDeclarationCollection 개체가 있는 경우 해당 인덱스를 가져옵니다.

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

매개 변수

value
CodeTypeDeclaration

컬렉션에서 찾을 CodeTypeDeclaration입니다.

반환

지정된 개체가 컬렉션에 있으면 해당 인덱스이고, 그렇지 않으면 -1입니다.

예제

다음 예제에서는 개체에서 항목을 검색 CodeTypeDeclaration 하고 메서드에서 CodeTypeDeclarationCollection 반환 IndexOf 된 이름과 인덱스를 표시합니다.

// Tests for the presence of a CodeTypeDeclaration in the 
// collection, and retrieves its index if it is found.
CodeTypeDeclaration^ testDeclaration = gcnew CodeTypeDeclaration( "TestType" );
int itemIndex = -1;
if ( collection->Contains( testDeclaration ) )
   itemIndex = collection->IndexOf( testDeclaration );
// Tests for the presence of a CodeTypeDeclaration in the
// collection, and retrieves its index if it is found.
CodeTypeDeclaration testDeclaration = new CodeTypeDeclaration("TestType");
int itemIndex = -1;
if( collection.Contains( testDeclaration ) )
    itemIndex = collection.IndexOf( testDeclaration );
' Tests for the presence of a CodeTypeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testDeclaration As New CodeTypeDeclaration("TestType")
Dim itemIndex As Integer = -1
If collection.Contains(testDeclaration) Then
    itemIndex = collection.IndexOf(testDeclaration)
End If

적용 대상

추가 정보