Reputation: 799
I am using a custom struct "PreciseTimeSpan" that consists like the regular .NET TimeSpan of a ticks value of datatype long. I want to serialize PreciseTimeSpan fields by serializing the ticks value as varint. Until now I created a private property for each PreciseTimeSpan field that performed the conversion from and to long. But this is quite inconvenient. Is it possible to serialize a custom class / struct as a primitive type?
Upvotes: 4
Views: 528
Reputation: 1063864
Whilst protobuf-net does support surrogate serialization types, it does not currently allow these to be mixed with primitive types. It is theoretically possible that it could do so, but: not today. If you really want, I could investigate this option.
Upvotes: 2