An efficient custom binary serializer running by the .NET standards

This library, also available via Nuget, provides FastBinaryFormatter class, an IFormatter implementation as a replacement for the standard BinaryFormatter for serialization purposes. It has the following features:

The significant performance gain comes at the cost of not supporting a very specific scenario:

During deserialization, if a registered ISerializationSurrogate returns in method SetObjectData a (non-null) different object than the one supplied to populate, then the data supplied in the SerializationInfo must not recursively cause a deserialization cycle up to the new object. A cycle is allowed though if it is established outside the deserialized objects. In particular, cycles formed by associations created by other surrogates are allowed.

The same restriction applies to IObjectReference implementations.

Note that support for returning a different non-null object in method SetObjectData has effect in version .NET 2.0 and later. The return value was previously ignored.

This scenario is highly unlikely to be found in practice. However, it is detected during deserialization and an exception is thrown upon occurrence.

The library has no dependencies.

Last edited May 13, 2014 at 9:18 PM by grammophone, version 14