/Metsys.Little

A fast and compact binary [de]serializer for .NET

Primary LanguageC#OtherNOASSERTION

Metsys.Little

Metsys.Little is a lightweight .NET binary serializer with a focus on compactness and speed. Given the following object:

var user = new User { Id = 433, Name = "Goku" Enabled = true, Initial = null, Description = null, };

Metsys.Little will serialize this to a 13 bytes. The built-in BinaryFormatter will take 400 bytes. The object created in the IntegrationTests.NestedTypesWithCollectionOfObjects method serializes to 74 bytes – the BinaryFormatter is over 900.

This is achieved without any cpu-intensive compression or other fancy tricks.

Limitations

Metsys.Little supports built-in value types (int/short/long/float/double/decimal/byte/char/enums/datetime) and strings. It also supports a number of IEnumerable’s – with the main exception being Dictionary types (non-generic types aren’t likely to work either).

The type must have a default constructor – it can be private.

Usage

Use the Serializer.Serialize method to turn your object into a byte array:
var data = Serializer.Serialize(new User{...});

Use the Deserializer.Deserialize method to turn your byte array (or stream) back into your object:
var user = Deserializer.Deserialize(data);