Share via


CodeParameterDeclarationExpressionCollection.IndexOf Método

Definición

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

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

Parámetros

value
CodeParameterDeclarationExpression

CodeParameterDeclarationExpression que se va a buscar en la colección.

Devoluciones

Índice de la colección a la que corresponde el objeto especificado, si se encuentra; de lo contrario, -1.

Ejemplos

En el ejemplo siguiente se busca la presencia de una instancia específica CodeParameterDeclarationExpression y se usa el IndexOf método para obtener el valor de índice en el que se encontró.

// Tests for the presence of a CodeParameterDeclarationExpression 
// in the collection, and retrieves its index if it is found.
CodeParameterDeclarationExpression^ testParameter = gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" );
int itemIndex = -1;
if ( collection->Contains( testParameter ) )
   itemIndex = collection->IndexOf( testParameter );
// Tests for the presence of a CodeParameterDeclarationExpression
// in the collection, and retrieves its index if it is found.
CodeParameterDeclarationExpression testParameter = new CodeParameterDeclarationExpression(typeof(int), "testIntArgument");
int itemIndex = -1;
if( collection.Contains( testParameter ) )
    itemIndex = collection.IndexOf( testParameter );
' Tests for the presence of a CodeParameterDeclarationExpression 
' in the collection, and retrieves its index if it is found.
Dim testParameter As New CodeParameterDeclarationExpression(GetType(Integer), "testIntArgument")
Dim itemIndex As Integer = -1
If collection.Contains(testParameter) Then
    itemIndex = collection.IndexOf(testParameter)
End If

Se aplica a

Consulte también