Can the compiler/runtime reorder or inline expression trees?
If I got the following code:
public static int SomeSimpleMethod(int x) {
return x;
}
void Main() {
Expression<Func<bool>> expr = () => SomeSimpleMethod(2) == 3;
}
Can expr then include something else than (in pseudo code)
Expression.Lambda
Expression.Equals
Expression.Call
Expression.Constant
Expression.Constant
Edit
I am just parsing the expression tree to find some items like the name of the method call (“SomeSimpleMethod”). The lambda will never be executed so I just want to ensure that the method call is not optimized away from the expression tree.
The compiler will never optimize that.