How to convert a ExpressionTree of form
Expression> exp = p => p.Age > 50;
to
Express
Rough Steps:
Get the expression Cast it to BinaryExpression Get the left operand Cast it to MemberExpression Get the Underlying Type that the property belong to Change it to your new type if you can.
The type you get here is a property without setter as I guessed.
Expression> exp1 = o => this.ActualHeight>50;
var type = ((MemberExpression)((BinaryExpression)exp1.Body).Left).Expression.Type;
So you must build a new expression
Here is the way
manually build linq expression for x => x.Child == itemToCompare.Child