Use the required Keyword in C# to Enforce Property Initialisation
Last week we saw how much code we can get rid of when we use the [init keyword to create immutable objects]. The only downside we found was that we cannot enforce that all properties get a value. To solve this problem, we can use the required keyword of C# 11:
The required modifier indicates that the field or property it is applied to must be initialized by an object initializer. Any expression that initializes a new instance of the type must initialize all required members. – from learn.microsoft.com
