是否有一种快捷方式来反序列化protobuf基类

时间:2017-11-29 05:45:39

标签: c# serialization protocol-buffers protobuf-net

我正在使用protobuf-net版本2.3.2.0。

[ProtoContract(ImplicitFields = ImplicitFields.AllFields)]
[ProtoInclude(12, typeof(SubClass))]
public class BaseClass
{
    public string Id { get; set; }
    public string Name { get; set; }
}

[ProtoContract(ImplicitFields = ImplicitFields.AllFields)]
public class SubClass : BaseClass
{
    public string PropertySub { get; set; }
}

因为我的基类是从许多子类继承的。 如何避免在我的基类上放置属性[ProtoInclude],以便我的基类中的props按预期反序列化。

0 个答案:

没有答案
相关问题