Skip to main content
Journey Uncommon Logo
JourneyUncommon
easyC#records vs classesSingle-choice MCQ

What does the record `with` expression do here?

record Person(string Name, int Age); var p1 = new Person("Ada", 30); var p2 = p1 with { Age = 31 }; Console.WriteLine($"{p1.Age} {p2.Age}");