with expression vs new keyword
问题 I was reading the devblogs about "what's new in C#9.0", then I noticed "with expression". public data class Person { public string FirstName { get; init; } public string LastName { get; init; } } var otherPerson = person with { LastName = "Hanselman" }; they say A record implicitly defines a protected “copy constructor” – a constructor that takes an existing record object and copies it field by field to the new one: protected Person(Person original) { /* copy all the fields */ } // generated