Share via


CodeCatchClauseCollection.IndexOf(CodeCatchClause) Método

Definição

Obtém o índice do objeto CodeCatchClause especificado na coleção, se ele existe na coleção.

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

Parâmetros

value
CodeCatchClause

O objeto CodeCatchClause a ser localizado na coleção.

Retornos

O índice do objeto especificado, se encontrado, na coleção; caso contrário, -1.

Exemplos

O exemplo a seguir pesquisa a presença de um objeto específico CodeCatchClause e usa o IndexOf método para obter o valor de índice no qual ele foi encontrado.

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

Aplica-se a

Confira também