Both fragments below the product of the same yield. I understand how Func encapsulates a method with a single parameter and returns a bool value. And you can either assign it a method, an anonymous method, or a lambda expression.
Func<int, bool> deleg = i => i < 5; Console.WriteLine("deleg(4) = {0}", deleg(4));
The following are expression trees that I do not yet fully understand. Why should I do this? Is it more flexible, what advantage does it give me?
System.Linq.Expressions.Expression<Func<int, bool>> expr = i => i < 5; Func<int, bool> deleg2 = expr.Compile(); Console.WriteLine("deleg2(4) = {0}", deleg2(4));
source share