public record User(string Name, int Age) {
public string Note { get; set; } = $"{Name}, aged {Age}";
public User(string name, int age, string note) : this(name, age) { // Without the 'this(name, age)', this ctor will not compile
Note = note;
}
}
void Test() {
Console.WriteLine(new User("Ben", 30).Note); // Ben, aged 30
Console.WriteLine(new User("Ben", 30, "Custom user note").Note); // Custom user note
}