I am using Protobuf.net to serialize some classes. I would like to be able to serialize the SuperHero class (below) without having to specify [ProtoInclude] on the base class. This is because the derived classes are automatically generated but the base class is not, so the base class does not directly know about its derived classes.
[ProtoContract]
class Person
{
[ProtoMember(1)]
public int Id { get; set; }
[ProtoMember(2)]
public string Name { get; set; }
}
[ProtoContract]
class SuperHero : Person
{
[ProtoMember(3)]
public string Powers { get; set; }
}
I am using the latest version of protobuf.net.