CSharp - Expression-bodied properties


You can declare a read-only property as an expression-bodied property.

A fat arrow replaces all the braces and the get and return keywords:

double r;
public double Area => r * r * pi;

The following code shows how to write set accessors to be expression-bodied:

public double Area
       get => r * r * pi;
       set => area = value;