Cover by Jon Skeet

Safari, the world’s most comprehensive technology and business learning platform.

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required

O'Reilly logo

Chapter 9. Lambda expressions and expression trees

This chapter covers

  • Lambda expression syntax
  • Conversions from lambdas to delegates
  • Expression tree framework classes
  • Conversions from lambdas to expression trees
  • Why expression trees matter
  • Changes to type inference
  • Changes to overload resolution

In chapter 5 we saw how C# 2 made delegates much easier to use due to implicit conversions of method groups, anonymous methods, and return type and parameter variance. This is enough to make event subscription significantly simpler and more readable, but delegates in C# 2 are still too bulky to be used all the time: a page of code full of anonymous methods is painful to read, and you wouldn’t want to start putting multiple anonymous methods ...

Find the exact information you need to solve a problem on the fly, or go deeper to master the technologies and skills you need to succeed

Start Free Trial

No credit card required