Share via


CodeCatchClauseCollection.IndexOf(CodeCatchClause) Méthode

Définition

Obtient l'index de l'objet CodeCatchClause spécifié dans la collection, s'il existe dans la collection.

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

Paramètres

value
CodeCatchClause

Objet CodeCatchClause à placer dans la collection.

Retours

Index de l'objet spécifié, s'il existe, dans la collection ; sinon, -1.

Exemples

L’exemple suivant recherche la présence d’un objet spécifique CodeCatchClause et utilise la IndexOf méthode pour obtenir la valeur d’index à laquelle il a été trouvé.

// Tests for the presence of a CodeCatchClause in the 
// collection, and retrieves its index if it is found.
CodeCatchClause^ testClause = gcnew 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.
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

S’applique à

Voir aussi