C
C#12mo ago
dave1

❔ base class/abstract for record

is the only way to do this and use the properties of a record to use method extensions
6 Replies
TheBoxyBear
TheBoxyBear12mo ago
You can define the members in an interface
dave1
dave112mo ago
I just switched it back to a class. I wanted to add a tostring method Which is the same across multiple record types
TheBoxyBear
TheBoxyBear12mo ago
Stack Overflow
C# 9.0 records - ToString not inherited
consider: // the ratioale for Wrapper is that it has a Json serializer that
// serialize through Field (not included in this example) record Wrapper<T> where T : notnull { protected Wrapp...
TheBoxyBear
TheBoxyBear12mo ago
If there's common behavior, you can make a static helper method to generate the string and call that in ToString
dave1
dave112mo ago
aye i think i'm going to avoid that, i want some overrides in there aswell for other things, so i'm just going to use a class i think
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.