The main problem here is that the protobuf specification simply does not have the concept of null - explicitly null / missing values ββcannot be expressed in protobuf format.
In each library, the library itself can choose to fake an extra layer to allow this thing, but:
- more bytes will be required for posting
- this will complicate the code and require additional configuration
- he (if necessary) would disable optimizations such as "packed" coding
It should probably detect zero and behave better, though!
I would advise you to serialize a list of things with a null value, not a list of null values. For instance:
[ProtoContract] public class Foo { [ProtoMember(1)] public double? Value {get;set;} }
The above list may contain null values. And basically itβs the same as me if I added the built-in support for zero substitution.
source share