13.07.2015 Views

C# in Depth

C# in Depth

C# in Depth

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Lambda expressionsand expression treesThis chapter covers■■■■■■■Lambda expression syntaxConversions from lambdas to delegatesExpression tree framework classesConversions from lambdas to expression treesWhy expression trees matterChanges to type <strong>in</strong>ferenceChanges to overload resolutionIn chapter 5 we saw how <strong>C#</strong> 2 made delegates much easier to use due to implicitconversions of method groups, anonymous methods, and parameter covariance.This is enough to make event subscription significantly simpler and more readable,but delegates <strong>in</strong> <strong>C#</strong> 2 are still too bulky to be used all the time: a page of code full ofanonymous methods is quite pa<strong>in</strong>ful to read, and you certa<strong>in</strong>ly wouldn’t want tostart putt<strong>in</strong>g multiple anonymous methods <strong>in</strong> a s<strong>in</strong>gle statement on a regular basis.One of the fundamental build<strong>in</strong>g blocks of LINQ is the ability to create pipel<strong>in</strong>esof operations, along with any state required by those operations. These operations230Licensed to Rhona Hadida

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!