0

I can not understand what map is it. Should i write number of serialized elements in bytes array into it?

var bytes = new byte[65356];
var s = MessagePackBinary.WriteMapHeader(ref bytes, 0, 567);
var ss = MessagePackBinary.ReadMapHeader(bytes, 0, out s);

result is 567.

I use MessagePack-CSharp serializer.

At docs i found that:

Write/ReadMapHeader Write/Read map format header(element length).

But it is not clear for me.

And another question: how can i write End of Object? I need when i will deserealize object back. But by object can be with different number of properties.

Admiral Land
  • 2,304
  • 7
  • 43
  • 81
  • 1
    Sounds like [XY problem](https://meta.stackexchange.com/q/66377/299295), why do you even use that method? There should be very simple way to serialize/deserialize without diving much into implementation. So what problem you are trying to solve with map and end of object? – Sinatr Jun 28 '19 at 12:25
  • 1
    The serialize and de-serialize should always be with the same number of properties unless you have some type of version number so newer version of the serialize method containing more properties can work with older versions. All data that is serialized must be used when de-serializing. If you are transmitting serialized data you must use a method that will correctly indicate the size of data either by prefixing the data with a byte count or terminating the data with a character not part of the message. – jdweng Jun 28 '19 at 14:54

0 Answers0