CodeCatchClauseCollection.IndexOf(CodeCatchClause) Metodo

Definizione

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

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.

Valori restituiti

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

Esempio

Nell'esempio seguente viene eseguita la ricerca della presenza di un oggetto specifico CodeCatchClause e viene utilizzato il IndexOf metodo per ottenere il 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 = 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