First, convenience: lambdas are easier to read and write.
Secondly, expressions: lambdas can be compiled either to a delegate or an expression tree ( Expression<T> for some type of T delegate, for example Func<int,bool> ). Expression trees are more exciting as this is the key to LINQ for inactive data stores.
Func<int,bool> isEven = i => i % 2 == 0; Expression<Func<int,bool>> isEven = i => i % 2 == 0;
Please note that lambda expressions with operator bodies can only be compiled by delegates, not Expression s:
Action a = () => { Console.WriteLine(obj.ToString()); };
Marc Gravell Oct. 16 '08 at 12:50 2008-10-16 12:50
source share