Chapter 7. C# 5 bonus features
- Changes to variable capture in foreach loops
- Caller information attributes
If C# had been designed with book authors in mind, this chapter wouldn’t exist, or it’d be a more standard length. I could claim that I wanted to include a very short chapter as a sort of palette cleanser after the dish of asynchrony served by C# 5 and before the sweetness of C# 6, but the reality is that two more changes in C# 5 that need to be covered wouldn’t fit into the async chapters. The first of these isn’t so much a feature as a correction to an earlier mistake in the language design.
7.1. Capturing variables in foreach loops
Before C# 5, foreach loops were described in the language specification ...
Get C# in Depth, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.