You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I have an example, where I have a BT_STRUCT with field ID 0, with data (which in turn comes with field IDs of 0, 1, and 2). I then encounter a BT_STOP_BASE and there is a new struct, also with field ID 0, with its own nested data (set of fields, with IDs of 0, 1, and 2).
Given that the structs themselves are not part of a specific field, and are sequential - what is the way to represent that in a C# class, so that I can deserialize/serialize the data? I am assuming some kind of entity with nested sub-classes, but so far I have been unsuccessful at replicating this.
Tagging @chwarr since he helped with some previous questions related to this (#74 (comment)).
The text was updated successfully, but these errors were encountered:
varobj=new Bar {foo_string="foo",bar_string="bar"};varoutput=new OutputBuffer();varwriter=newCompactBinaryWriter<OutputBuffer>(output);
Serialize.To(writer, src);
The Compact Binary payload would be, in pseudo payload:
BT_STRING { id: 0, length: 3 }
foo
BT_STOP_BASE
BT_STRING { id: 0, length: 3 }
bar
BT_STOP
If you added another layer, struct Baz : Bar { 0: string baz_string; }, there would be two BT_STOP_BASE tokens, one after the Foo and one after the Bar:
chwarr
changed the title
[Question] In C# implementation, how to parse to structs separated by BT_STOP_BASE
In C# implementation, how to parse to structs separated by BT_STOP_BASE
Aug 24, 2022
Let's say I have an example, where I have a
BT_STRUCT
with field ID 0, with data (which in turn comes with field IDs of 0, 1, and 2). I then encounter aBT_STOP_BASE
and there is a new struct, also with field ID 0, with its own nested data (set of fields, with IDs of 0, 1, and 2).Given that the structs themselves are not part of a specific field, and are sequential - what is the way to represent that in a C# class, so that I can deserialize/serialize the data? I am assuming some kind of entity with nested sub-classes, but so far I have been unsuccessful at replicating this.
Tagging @chwarr since he helped with some previous questions related to this (#74 (comment)).
The text was updated successfully, but these errors were encountered: