Generating multiple serializers for the same types #352
-
@jamescourtney I'm thinking of having multiple Then depending on which type of serialization I want to use, I can easily have access to the other serializers. Does this seem like a good approach? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
FlatSharp v7 does this by default: https://github.com/jamescourtney/FlatSharp/releases/tag/7.0.0. The
public static T ParseProgressive<T>(byte[] buffer) where T : IFlatBufferSerializable<T>
{
return T.ProgressiveSerializer.Parse(buffer);
} |
Beta Was this translation helpful? Give feedback.
FlatSharp v7 does this by default: https://github.com/jamescourtney/FlatSharp/releases/tag/7.0.0. The
fs_serializer
attribute now only specifies the default serializer forYourType.Serializer
. There are a few ways to gain access to the other serializers:YourType.Serializer.Parse(buffer, FlatBufferDeserializationOption.Progressive)
var progressiveSerializer = YourType.Serializer.WithSettings(opts => opts.UseProgressiveDeserialization());