Expression bodies for accessors, constructors, and finalizers

Expression-bodied members have been a big hit with the C# developer community, so much so that Microsoft has expanded the allowed members that can be implemented as expressions. You can now use this feature with:

  • Constructors
  • Finalizers (used when you need to release unmanaged code)
  • get and set accessors on properties and indexers

Get C# 7 and .NET Core Cookbook 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.