3 ms·
I think you can add default constructor manually. Something like this: public record Foo(int X, int Y) { public Foo():this(0,0) { } } Or make all
by zigzag312 5y ago
I think you can add default constructor manually. Something like this:
public record Foo(int X, int Y)
{
public Foo():this(0,0) { }
}
Or make all parameters optional
public record Foo(int X = 0, int Y = 0);
- DeathArrow 5y agoTried with public Record Foo(int x = default, int y = default); and it still complained about missing a constructor. I didn't try to add an constructor like you suggested, it's still shorter than defining all members.