Share via


CodeCatchClauseCollection.IndexOf(CodeCatchClause) Metodo

Definizione

Ottiene l'indice dell'oggetto CodeCatchClause specificato nell'insieme, se esistente.

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

Parametri

value
CodeCatchClause

Oggetto CodeCatchClause da individuare nell'insieme.

Restituisce

Indice dell'oggetto specificato, se presente nell'insieme, in caso contrario -1.

Esempio

L'esempio seguente cerca la presenza di un oggetto specifico CodeCatchClause e usa il metodo per ottenere il IndexOf valore di indice in corrispondenza del quale è stato trovato.

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

Si applica a

Vedi anche