Expression::ArrayIndex Method (Expression^, array<Expression^>^)
Creates a MethodCallExpression that represents applying an array index operator to a multidimensional array.
Assembly: System.Core (in System.Core.dll)
public: static MethodCallExpression^ ArrayIndex( Expression^ array, ... array<Expression^>^ indexes )
Parameters
- array
-
Type:
System.Linq.Expressions::Expression^
An array of Expression instances - indexes for the array index operation.
- indexes
-
Type:
array<System.Linq.Expressions::Expression^>^
An array of Expression objects to use to populate the Arguments collection.
Return Value
Type: System.Linq.Expressions::MethodCallExpression^A MethodCallExpression that has the NodeType property equal to Call and the Object and Arguments properties set to the specified values.
| Exception | Condition |
|---|---|
| ArgumentNullException | array or indexes is null. |
| ArgumentException |
Each element of indexes must have Type equal to Int32. The 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 BinaryExpression. The Left property is set to array and the Right property is set to the single element of indexes. The Type property of theBinaryExpression represents the element type of array.Type.
If the rank of array.Type is more than one, this method returns a MethodCallExpression. The Method property is set to the MethodInfo that describes the public instance method Get on the type represented by the Type property of array.
The following example demonstrates how to use the ArrayIndex(Expression^, array<Expression^>^) method to create a MethodCallExpression that represents indexing into a two-dimensional array.
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1