Reputation: 516
I have serialized this class:
[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...
}
How do I skip the [ProtoMember(1)] hugeArray during deserialization, so that only x, y, and other fields get deserialized?
My problem is that sometimes I quickly need only to get the 'metadata', which is what other fields and properties describe, but sometimes I need an entire object.
Upvotes: 3
Views: 1783
Reputation: 1062780
Two options:
RuntimeTypeModel
instances (one built manually with only the desired fields specified)TestClass
that simply omits the big fields - i.e. TestClassMetadata
- and deserialize into that; protobuf-net won't mind at allUpvotes: 4