Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 有没有反序列化protobuf基类的捷径_C#_Serialization_Protocol Buffers_Protobuf Net - Fatal编程技术网

C# 有没有反序列化protobuf基类的捷径

C# 有没有反序列化protobuf基类的捷径,c#,serialization,protocol-buffers,protobuf-net,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(ImplicitFiel

我正在使用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]
,以便基类中的道具按预期反序列化。

据我所知,没有。但是您可以在运行时完全构建您的模型(使用反射探索您的类)。@Evk Ok。。让我检查一下。谢谢据我所知没有。但是您可以在运行时完全构建您的模型(使用反射探索您的类)。@Evk Ok。。让我检查一下。谢谢