CodeParameterDeclarationExpressionCollection.IndexOf Metod

Definition

Hämtar indexet i samlingen för den angivna CodeParameterDeclarationExpression, om det finns i samlingen.

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

Parametrar

Returer

Indexet i samlingen av det angivna objektet, om det hittas; annars -1.

Exempel

I följande exempel söker du efter förekomsten av en specifik CodeParameterDeclarationExpression instans och använder IndexOf metoden för att hämta indexvärdet där den hittades.

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

Gäller för

Se även