Lets say we have the following class.
public class Person
{
public string FirstName { get; init; }
public string LastName { get; init; }
}
This would enforce us to set both properties. However.. Lets say we dont want to allow the value to be null, or maybe even not allow the FirstName to start with the letter/char "A" or enforce the names to start with a char in upper case. (guard the values)
We could create add a constructor that takes zero arguments, however.. Then we no longer will get a "heads up" by the compiler/IDE that a few props needs to be set.
How would you "guard" values when using init?