Chapter 8. Super-sleek properties and expression-bodied members

This chapter covers
  • Implementing read-only properties automatically
  • Initializing automatically implemented properties at their declaration
  • Removing unnecessary ceremony with expression-bodied members

Some versions of C# have one big, unifying feature that almost all other features contribute to. For example, C# 3 introduced LINQ, and C# 5 introduced asynchrony. C# 6 isn’t like that, but it does have a general theme. Almost all the features contribute to cleaner, simpler, and more readable code. C# 6 isn’t about doing more; it’s about doing the same work with less code.

The features you’ll look at in this chapter are about properties and other simple pieces ...

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.