Skip to content
Discussion options

You must be logged in to vote

Positional records have init property accessors to support with:

record Person(string First, string Last);

var person1 = new Person("John", "Smith");
var person2 = person1 with { Last = "Jones" };

// compiles into
var person2 = person1.<>Clone();
person2.Last = "Jones";

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@thomaslevesque
Comment options

Answer selected by YairHalberstadt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants