Serialization Protobuf net跳过特定字段的反序列化
我已序列化此类:Serialization Protobuf net跳过特定字段的反序列化,serialization,protobuf-net,Serialization,Protobuf Net,我已序列化此类: [ProtoContract] public class TestClass { [ProtoMember(1)] public int[] hugeArray; [ProtoMember(2)] public int x; [ProtoMember(3)] public int y; //lot more fields and properties to serialize here... } 如何在反序列化过程中跳过[ProtoMembe
[ProtoContract]
public class TestClass
{
[ProtoMember(1)] public int[] hugeArray;
[ProtoMember(2)] public int x;
[ProtoMember(3)] public int y;
//lot more fields and properties to serialize here...
}
如何在反序列化过程中跳过[ProtoMember(1)]hugarray,以便只反序列化x、y和其他字段
我的问题是,有时我只需要快速获取“元数据”,这是其他字段和属性所描述的,但有时我需要整个对象。两个选项:
- 两个
实例(一个手动构建,仅指定所需字段)RuntimeTypeModel
- 两种类型;i、 e.创建一个更简单的
,它只是省略了大字段,即TestClass
,并反序列化到该字段中;protobuf网络不会介意的TestClassMetadata