Creating Expression Trees by Using the API C# with Example
using System.Linq.Expressions; // Manually build the expression tree for // the lambda expression num => num < 5. ParameterExpression numParam = Expression.Parameter(typeof(int), "num"); ConstantExpression five = Expression.Constant(5, typeof(int)); BinaryExpression numLessThanFive = Expression.LessThan(numParam, five); Expression> lambda1 = Expression.Lambda>( numLessThanFive, new ParameterExpression[] { numParam });