CodeParameterDeclarationExpressionCollection.IndexOf Método

Definição

Obtém o índice na coleção do especificado CodeParameterDeclarationExpression, se ele existir na coleção.

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

Retornos

O índice na coleção do objeto especificado, se encontrado; caso contrário, -1.

Exemplos

O exemplo a seguir pesquisa a presença de uma instância específica CodeParameterDeclarationExpression e usa o IndexOf método para obter o valor de índice no qual foi encontrado.

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

Aplica-se a

Confira também