CodeCatchClauseCollection.IndexOf(CodeCatchClause) Método

Definición

Obtiene el índice del objeto CodeCatchClause especificado en la colección, si existe en la colección.

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

Objeto CodeCatchClause que se va a buscar en la colección.

Devoluciones

Índice del objeto especificado, si se encuentra en la colección; de lo contrario, -1.

Ejemplos

En el ejemplo siguiente se busca la presencia de un objeto específico CodeCatchClause y se usa el IndexOf método para obtener el valor de índice en el que se encontró.

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

Se aplica a

Consulte también