System.Linq.Expressions.Expression.ArrayIndex Method

Creates a System.Linq.Expressions.MethodCallExpression that represents applying an array index operator to an array of rank more than one.

Syntax

public static MethodCallExpression ArrayIndex (Expression array, IEnumerable<Expression> indexes)

Parameters

array
An System.Linq.Expressions.Expression to set the MethodCallExpression.Object property equal to.
indexes
An IEnumerable`1 that contains System.Linq.Expressions.Expression objects to use to populate the MethodCallExpression.Arguments collection.

Returns

A System.Linq.Expressions.MethodCallExpression that has the Expression.NodeType property equal to ExpressionType.Call and the MethodCallExpression.Object and MethodCallExpression.Arguments properties set to the specified values.

Remarks

Each element of indexes must have Expression.Type equal to int. The Expression.Type property of array must represent an array type whose rank matches the number of elements in indexes.

If the rank of array.Type is 1, this method returns a System.Linq.Expressions.BinaryExpression. The BinaryExpression.Left property is set to array and the BinaryExpression.Right property is set to the single element of indexes. The Expression.Type property of the System.Linq.Expressions.BinaryExpression represents the element type of array.Type.

If the rank of array.Type is more than one, this method returns a System.Linq.Expressions.MethodCallExpression. The MethodCallExpression.Method property is set to the System.Reflection.MethodInfo that describes the public instance method Get on the type represented by the Expression.Type property of array.

Requirements

Namespace: System.Linq.Expressions
Assembly: System.Core (in System.Core.dll)
Assembly Versions: 3.5.0.0, 4.0.0.0