We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
record Foo(int X); void Test() { Foo f = new(1); f = f with { X = 2 }; // warning: 'with' keyword used outside record declaration }
Suggested best practice:
record Foo(int X) { public Foo WithX(int x) => this with { X = x }; public Bar WithY(int y) => new(this, y); } record Bar(int X, int Y) : Foo (X) { public Bar(Foo foo, int y) : this(foo.X, y) { } } void Test() { Foo f = new(2); f = f.WithX(2); Bar b = f.WithY(3); }
The text was updated successfully, but these errors were encountered:
Added in 1.0.18
Sorry, something went wrong.
ronnygunawan
No branches or pull requests
Suggested best practice:
The text was updated successfully, but these errors were encountered: