FluentSerializer 0.80 Codename
The first step is always the hardest
by M. Alberti (xanatos(at)live.it)
What is FluentSerializer?
FluentSerializer is a fluent library for C# and .NET that lets the user serialize/deserialize data in an user-defined binary format. The user creates Fluent Expressions that describe the serialization format and the library compiles and uses them. It is
the real reason I created the
It was born the day I asked this
question on StackOverflow (technically it was born some days/months after this event, when I got tired no one had given me a good reply).
Why is this library useful?
The C# 4.0 and 4.5 don't have facilities to serialize/deserialize complex data types written in legacy formats. This library tries to solve this problem. It's very much a work in progress, but it's quite stable.
What versions of .NET does it support?
FluentSerializer requires .NET 4.0. It has been tested with Mono 2.10.8.
What license is FluentSerializer released under?
FluentSerializer is released under the MIT license. If you need something more liberal (a beerware license?) you can ask me.
What is included in the solution?
The solution includes the projects:
FluentSerializer, the main library
Sample, a small code sample that shows how to serialize many types
Tests, the unit test that tests all the serializers (not finished... not even begun.)
Why is your code so obsessively-compulsively tidy?
FluentSerializer (and its author) are proud users of
StyleCop (minimum version 4.7). A clean code is a sign of respect for those who will use it. The projects included in the solution will try to use the MSBuild include file for StyleCop if present in the folder
$(ProgramFiles)\MSBuild\StyleCop\v4.7 folder (where $(ProgramFiles) is normally
C:\Program Files or C:\Program Files (x86)). To install the MSBuild include file you have to check the
MSBuild integration checkbox during the installation of StyleCop.
Why isn't the code commented?
FluentSerializer (and its author) are proud users of StyleCop. Sadly the author is too much lazy to document the code. This is a sign of disrespect for those who will use it, but the author isn't very worried :-) Fortunately for the author, there are settings
in StyleCop to disable the checking of comments.
Why is your English so much poor?
FluentSerializer has been written by an author who speaks very well Italian, but not so well British English or American English (or any other English idiom). This is unfortunate, perhaps even tragic :-)
Why is this README a carbon copy of the README of
No more questions for today, the author is very tired :-)
Serializer<T>.Dump() doesn't work with type that serialize readonly fields that need assignation (i.e.
int readonly MyVar).
Can't convert-and-serialize (serialize an int as short, for example, or a short as an int).
No support for endianness control of the serialized data.
No support for zero-terminated strings (C strings).
No support for zero-terminated collections (like envp in C).
No support for specifying if a type must be Dispose(d) or if an object must be reused or destroyed and recreated.
The parameters of the serializers should be sanitized, so if a non-parameter is passed as a parameter (especially through
Expression "inclusion") then the value is cached in a temporary variable.
The README is finished. Now go playing with the library.