CSharp - Property Property initializers


You can add a property initializer to automatic properties:

public decimal CurrentRadius { get; set; } = 123;

This gives CurrentRadius an initial value of 123.

Properties with an initializer can be read-only:

public int Maximum { get; } = 999;

Read-only automatic properties can also be assigned in the type's constructor.