Lambda expressions

With extension methods and anonymous methods (or inline methods), Visual Studio introduces an expression called the lambda expression.

A lambda expression is actually a syntax change for anonymous methods. It is just another way of writing anonymous methods.

Now, let's learn what a lambda expression is, step by step.

First we need to understand what a delegate is. A delegate is a type that references a method, which means you can define a delegate and then assign a method to it. Once a delegate is assigned a method, it behaves exactly like that method. The delegate method can be used like any other method, with parameters and a return value.

In C# there is a generic delegate type, Func<A,R>, which represents a function taking ...

Get WCF 4.5 Multi-Layer Services Development with Entity Framework now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.