C# in Depth

Cover of C# in Depth
Order now (3rd edition)

Briefer code in listing 9.4

Chapter 9: Lambda expressions and expression trees: P236

Created: 5/13/2008
Last updated: 5/13/2008
Severity: Language improvement

The code in listing 9.4 can be abbreviated slightly. The lambda expression used to print the films list doesn't need braces. The code which appears like this:

Action<Film> print = film => { Console.WriteLine(film); };

can be changed to this:

Action<Film> print = film => Console.WriteLine(film);

This change has been made to the downloadable code. See also this note for even more significant abbreviations.