For my new Pet-Project I have a question for design, that is decided already, but I want some other opinions on that too.
I have a two classes (simplyfied):
class MyObject
{
string name {get;set;}
enum relation {get;set;}
int value {get;set;}
}
class MyObjectGroup
{
string name {get;set;}
enum relation {get;set;}
int value {get;set;}
List<MyObject> myobjects {get;set;}
}
Later in the Project MyObjectGroup and MyObject should be used equally. For this I could go two ways:
- Create an interface: IObject
- Create an abstract class: ObjectBase
I decided to go the way of the interface, that I later in code must not write ObjectBase everytime but IObject - just for ease - but what are other positives for this way.
And second, what about adding IXmlSerializable to the whole story? Let the interface inherit from IXmlSerializable or does it have more positives to implement IXmlSerializable in abstract base class?