CodeExpressionCollection.IndexOf(CodeExpression) Metodo

Definizione

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

public:
 int IndexOf(System::CodeDom::CodeExpression ^ value);
public int IndexOf (System.CodeDom.CodeExpression value);
member this.IndexOf : System.CodeDom.CodeExpression -> int
Public Function IndexOf (value As CodeExpression) As Integer

Parametri

value
CodeExpression

Oggetto CodeExpression 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 CodeExpression e usa il metodo per ottenere il IndexOf valore di indice in corrispondenza del quale è stato trovato.

// Tests for the presence of a CodeExpression in the 
// collection, and retrieves its index if it is found.
CodeExpression^ testComment = gcnew CodePrimitiveExpression( true );
int itemIndex = -1;
if ( collection->Contains( testComment ) )
   itemIndex = collection->IndexOf( testComment );
// Tests for the presence of a CodeExpression in the
// collection, and retrieves its index if it is found.
CodeExpression testComment = new CodePrimitiveExpression(true);
int itemIndex = -1;
if( collection.Contains( testComment ) )
    itemIndex = collection.IndexOf( testComment );
' Tests for the presence of a CodeExpression in the 
' collection, and retrieves its index if it is found.
Dim testComment = New CodePrimitiveExpression(True)
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
    itemIndex = collection.IndexOf(testComment)
End If

Si applica a

Vedi anche