CodeCatchClauseCollection.IndexOf(CodeCatchClause) Methode

Definitie

Hiermee haalt u de index op van het opgegeven CodeCatchClause object in de verzameling, als het in de verzameling bestaat.

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

Parameters

value
CodeCatchClause

Het CodeCatchClause object dat in de verzameling moet worden gevonden.

Retouren

De index van het opgegeven object, indien gevonden, in de verzameling; anders, -1.

Voorbeelden

In het volgende voorbeeld wordt gezocht naar de aanwezigheid van een specifiek CodeCatchClause object en wordt de IndexOf methode gebruikt om de indexwaarde op te halen waarop het is gevonden.

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

Van toepassing op

Zie ook