This is what I can see in the QuickView window:
I want to use the Expressions property in my code, but it is not accessible:
Does anyone know how to use this Expressions property in code?
The compile-time type of expression.Body
is Expression
. No such property exists.
The runtime type of expression.Body
appears to be a NewArrayInitExpression
. That type has the Expressions
property that you're looking for.
You need to cast it to the appropriate type to be able to access the appropriate property. The closest accessible type is NewArrayExpression
.
var expressions = ((NewArrayExpression)expression.Body).Expressions;