PreviousNext

C# 9.0: Init-only properties

by miguelbernard, 2020-08-25T14:02:05.506Z

There's a lot of different ways to create an object in C# and set its state. There are the constructor, the setters on properties, and the object initializers introduced in C# 7.0. Although we have all those methods to create an object, it feels like something is missing. How do you construct an object and make it immutable after creation? C# 9.0 is solving this issue with the init-only properties.

Read More