C# 9 records validation
I’m late to the party, but this might still help someone… There’s actually a simple solution (but please read the warning below before using it). Define a base record type like this: public abstract record RecordWithValidation { protected RecordWithValidation() { Validate(); } protected virtual void Validate() { } } And make your actual record inherit … Read more