Skip to content
Discussion options

You must be logged in to vote

What I have been expected of with-expression, for a long time, is to behave not as an instance method but as a pure record object initializer.

Since I wrote in C# 7, as follows, an expanded Clone() method to do the same thing as with-expression does and it has been working well on LINQ to Object, the current function of with-expression is just a slightly simplified substitute if it clones an instance and then rewrites some properties to work as an instance method.

var rec2 = rec1.Clone(new { PropC = 0 }) as MyRecord; // C# 7 notation equivalent to Expression (A)

When someone rejects my proposal, all I need is a reasonable clarification why with-expression cannot be implemented as a pure i…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@HaloFour
Comment options

@CrayonPastel
Comment options

@HaloFour
Comment options

@CrayonPastel
Comment options

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