You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the latest .NET 5 preview I played around with records and noticed a for me unexpected behavior.
Given 2 records
record R1(int P1);
record R2 : R1(1);
This will result in
and
My expectation would have been that the old behavior of the first version of primary constructors would still work here.
Old behavior = It would call the constructor of R1 with the value 1 and creates R2 with the default ctor call.
Currently it seems that R2 that R1 got an empty constructor defined and R1 expects R2 to have an argument list that matches the given one.
record R1(int P1);
record R2(int P1) : R1(1);
would work but this actually doesn't make any sense for me.
And using an empty parameter list on R2 doesn't seem to be supported (why???)