Maxim Zaks
1 min readAug 19, 2021

--

Hi Jacques, object “casting” can have two strategies:

  1. Complete deserialisation of the underlying map (stored in buffer) into a typed object tree
  2. The object is a typed proxy for lazy access of values stored in buffer

FlatBuffers has same strategies, second (lazy one) being the default and the first one can be achieved with --gen-object-api, I think it is supported in C# code gen.

Those two strategies can be achieved with code generation, or with runtime reflection. That sad the second strategy is harder, or maybe even impossible to do with runtime reflection, you would have to dig into C# reflection features and find out if it is possible to identify the name of the property, user is calling.

I considered to add the features to FlexBuffers-CSharp, but decided against it, becuase the whole point of FlexBuffers is to have something flexible which does not need code generation and it makes the most sense if you need to extract only a fraction of the data at a time, making the value acces very efficient. Putting runtime reflection on top of this data extraction might defeat performance gains.

That sad if you care to try it out I would gladly assist you on your endeavour.

--

--

Maxim Zaks
Maxim Zaks

Written by Maxim Zaks

Tells computers how to waste electricity. Hopefully in efficient, or at least useful way.

No responses yet