【发布时间】:2017-11-13 00:32:57
【问题描述】:
所以我有一个要序列化的类,除了某个值“键” 将用于识别要反序列化它的类。
现在我明白了,这可以手动完成,但我创建了一个处理序列化/反序列化的类,我想让它尽可能通用。
示例代码
[ProtoContract]
public class GeneralPacket
{
public uint Identity;
[ProtoMember(1, IsRequired = true)]
public uint Arg1;
[ProtoMember(2, IsRequired = true)]
public uint Arg2;
[ProtoMember(3, IsRequired = true)]
public uint Arg3;
}
我希望身份包含在流中但不序列化。
【问题讨论】:
标签: c# protobuf-net