Closed NVentimiglia closed 3 years ago
You don't know the max size until you look at the instance. Strings and Vectors can be arbitrary in length, so I don't see how this would work.
What about a generic deserialization method ? Pass in a Type and buffer as arguments, returns an instance.
Did you mean non-generic? Most of the default functionality is exposed via generics with FlatBufferSerializer
. If you want non-generic, the following methods can help you:
ISerializer FlatBufferSerializer.Instance.Compile(object item)
ISerializer FlatBufferSerializer.Instance.Compile(Type itemType)
The results of compile are cached, so repeated calls for the same type return the same instance. Of course, the ISerializer
you get back is valid only for that type of type of object.
@NVentimiglia , let me know if you have more questions.
This seems unnecessary to require an instance of a type to determine the max size of a object.
would be better to just pass in a type.