I was trying to use protobuf-net and faced with the following problem. I have two classes.
[ProtoContract]
class parent
{
[ProtoMember(1)]
public string name { get; set; }
}
[ProtoContract]
class child : parent
{
[ProtoMember(2)]
public int num { get; set; }
}
If I create a child object without setting the child property "num"
var obj = new child() { name = "tester" };
and try to serialize it
using (var stream = new MemoryStream())
{
Serializer.NonGeneric.Serialize(stream, obj);
}
the stream will be empty.
Is there any way to handle this situation without using the attribute [ProtoInclude] for the parent class?
I'm using protobuf-net v2 r480.
Thanks