What is the difference between these 2? From the API documentation it seems like they were meant to do the exact same thing.
ArrayAccess
vs.
ArrayIndex
In which case they seem redundant, so I must be missing something here.
Edit: My initial answer was so badly wrong that I'm trying again.
Expression.ArrayAccess
returns an IndexExpression
which can be used to get or set the value of an element in an array.
Expression.ArrayIndex
returns either a BinaryExpression
or a MethodCallExpression
depending on the rank (number of dimensions) of the provided array expression. The returned expression can then be used to read a value from the array.
So ArrayAccess
gives you an expression that provides both read and write access to the array data, while ArrayIndex
gives you read access only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With