Protobuf-net .proto file generation for inheritance

微笑、不失礼 提交于 2019-11-30 15:42:54

Since inheritance is not part of the core spec, I basically represent this using encapsulation. So your [ProtoInclude] maps to:

message ProtoAlien {
   // other fields 1 thru 6 [snip]
   optional ProtoScholar ProtoScholar = 7;
}
message ProtoScholar {
   optional string Subject = 1;
}

GetProto<T>() is undergoing an overhaul in v2, so it should support a few more of these scenarios.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!