5.0.0
Version 5 is a major release for FlatSharp, with support for lots of new features:
- ~5-15% performance uplift for both Serialize and Parse workflows, depending on scenario.
file_identifier
androot_type
support- Updated Flatsharp FBS annotations to start with
fs_
- Deserialized FlatSharp objects now implement
IFlatBufferDeserializedObject
so objects can be queried to see if they are deserialized. - Non-Generic Serialize/Parse methods exposed via
FlatBufferSerializer.Default.Compile(Type t)
orFlatBufferSerializer.Default.Compile(object o)
- Types are no longer required to expose parameterless constructors (can use a constructor accepting
FlatBufferDeserializationContext
instead). - Support for fixed-size vectors in structs:
field:[int:8]
- Support for C# 8 and 9 features
- Nullable annotations in FlatSharp core libraries and generated C#
- Init-only properties
Breaking changes:
- Compiler no longer supports the
NoCustomType
metadata on unions. - Compiler no longer suports the
ObsoleteDefaultConstructor
metadata. It has been replaced withfs_defaultCtor
, which provides more options. - For memory vectors, compiler generates nullable
Memory<byte>?
instead of previous behavior of non-nullable. This is more in-line with how flatbuffers treats vectors as optional fields. ITypeModel
has had interface changes.FlatBufferUnion
and derivatives no longer supply aClone
method.OnInitialized
partial methods for generated types now accepts aFlatBufferDeserializationContext
parameter instead of no parameter.- Generated code requires C# 8 compiler, C# 9 for full nullable support.