"Demonstration of Difference Between Record and Non-Record Primary Constructor Property Generation"

sealed class User(string name, int age) { }

static void Test() {
	var user = new User("Ben", 33);
	Console.WriteLine(user.Name); // Doesn't compile unless User is a record type (and 'name' is renamed to 'Name')
}


Code snippet taken from "Complete C# Quick Reference - C# 12".