CodeCatchClauseCollection.IndexOf(CodeCatchClause) Methode

Definition

Ruft den Index des angegebenen CodeCatchClause Objekts in der Auflistung ab, falls es in der Auflistung vorhanden ist.

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

Parameter

value
CodeCatchClause

Das CodeCatchClause Objekt, das in der Auflistung gefunden werden soll.

Gibt zurück

Der Index des angegebenen Objekts, falls gefunden, in der Auflistung; andernfalls -1.

Beispiele

Im folgenden Beispiel wird nach dem Vorhandensein eines bestimmten CodeCatchClause Objekts gesucht und die IndexOf Methode verwendet, um den Indexwert abzurufen, an dem es gefunden wurde.

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

Gilt für:

Weitere Informationen