I was wondering what the benefits of using Lambda Expressions are. Can someone think of examples of where they would be beneficial to use? Let's say that I have a website where I want to add and manipulate customer and product information from a database. Is that a good place to use them for instance? Thank you in advance!
Best Answer Andre S. , 27 June 2013 - 23:38
Lambdas are more than inline functions, they are also closures. Any lambda that captures local variables, fields, etc, is compiled not to a method but to a type. C++ programmers are familiar with this concept under the name of functors; it was the only way to do closures before the advent of lambda expressions in C++11. C# had support for closures before lambdas actually, in C# 2.0 there were already anonymous methods which are basically lambdas with an ugly syntax. With lambdas, LINQ and the Func and Action types, C# 3.0 made functional programming much easier.Go to the full post