Jazyk

CodeCatchClauseCollection.IndexOf(CodeCatchClause) Metoda

Definice

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

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

Parametry

value
CodeCatchClause

Objekt CodeCatchClause , který chcete vyhledat v kolekci.

Návraty

Index zadaného objektu, pokud je nalezen, v kolekci; jinak, -1.

Příklady

Následující příklad vyhledá přítomnost konkrétního CodeCatchClause objektu a použije metodu IndexOf k získání hodnoty indexu, při které byl nalezen.

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

Platí pro

Viz také