CompilerErrorCollection.IndexOf(CompilerError) 메서드

정의

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

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

매개 변수

value
CompilerError

찾을 CompilerError입니다.

반환

CompilerError에 지정된 CompilerErrorCollection의 인덱스가 있으면 반환 값은 해당 인덱스이고, 그렇지 않으면 -1입니다.

예제

다음 예제에서는 특정 CompilerError 개체를 검색하고 메서드를 IndexOf 사용하여 발견된 인덱스 값을 확인합니다.

// Tests for the presence of a CompilerError in the
// collection, and retrieves its index if it is found.
CompilerError^ testError = gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" );
int itemIndex = -1;
if ( collection->Contains( testError ) )
   itemIndex = collection->IndexOf( testError );
// Tests for the presence of a CompilerError in the
// collection, and retrieves its index if it is found.
CompilerError testError = new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text");
int itemIndex = -1;
if( collection.Contains( testError ) )
    itemIndex = collection.IndexOf( testError );
' Tests for the presence of a CompilerError in the 
' collection, and retrieves its index if it is found.
Dim testError As New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text")
Dim itemIndex As Integer = -1
If collection.Contains(testError) Then
    itemIndex = collection.IndexOf(testError)
End If

적용 대상

추가 정보