"Hiding Mutable Primary Constructor Fields"

public sealed class User(string name, int age) {
	// Notice we've added two readonly fields back in:
	readonly string name = name;
	readonly int age = age;

	public void PrintNameAndAge() {
		Console.WriteLine($"User name: {name}, Age: {age}");
	}

	public void PrintNameAllCapsIfOld(int oldThreshold) {
		if (age >= oldThreshold) {
			name = name.ToUpperInvariant(); // This line no longer compiles
		}

		Console.WriteLine(name);
	}
}


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