O'Reilly logo

Pro C# 2010 and the .NET 4 Platform, Fifth Edition by Andrew Troelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.11. Understanding Lambda Expressions

To conclude our look at the .NET event architecture, we will examine C# lambda expressions. As just explained, C# supports the ability to handle events "inline" by assigning a block of code statements directly to an event using anonymous methods, rather than building a stand-alone method to be called by the underlying delegate. Lambda expressions are nothing more than a very concise way to author anonymous methods and ultimately simplify how we work with the .NET delegate type.

To set the stage for our examination of lambda expressions, create a new Console Application named SimpleLambdaExpressions. To begin, consider the FindAll() method of the generic List<T> class. This method can be called when you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required