async and await, the feature that reshaped how C# handles asynchronous work.
This release added 3 features, each with a before-and-after example.
Features in C# 5.0
- Asynchronous members - Provide
asyncandawaitoperations to simplify Task-based operations. - Caller info attributes - Provide parameter attributes to capture information about the caller of a method.
- Foreach variable capture fix - Each iteration of
foreachnow captures its own copy of the loop variable.