Sdílet prostřednictvím


CompilerErrorCollection.IndexOf(CompilerError) Metoda

Definice

Získá index zadaného CompilerError objektu v kolekci, pokud existuje v kolekci.

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

Parametry

value
CompilerError

Vyhledá CompilerError se.

Návraty

Index zadaného CompilerError v CompilerErrorCollection, pokud je nalezen; jinak -1.

Příklady

Následující příklad vyhledá konkrétní CompilerError objekt a pomocí IndexOf metody určí hodnotu indexu, na které byl nalezen.

// 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

Platí pro

Viz také