-
Notifications
You must be signed in to change notification settings - Fork 9
Home
Welcome to the official AnySerializer documentation wiki! In here, you will find a few snippets and further information about AnySerializer. You may want to read the introductory README before continuing for basic usage examples.
Install AnySerializer from the Package Manager Console:
PM> Install-Package AnySerializer
AnySerializer is compatible with .Net Standard 2.0+ and .Net Framework 4.0+
The only dependencies AnySerializer has is for Newtonsoft.Json and that's purely for attributes. We may look at removing that dependency to keep the library lean.
Performance AnySerializer has not yet been optimized for performance and that is planned shortly. The core ideology behind AnySerializer was to support a wide range of serialization challenges rather than being super fast. It's a tool to solve problems.
There are other serialization options out there such as ProtoBuf (my favorite goto for projects when sufficient), and Microsoft's built-in BinaryFormatter. Both are good options if they fit your needs, especially ProtoBuf which is much higher performance. I built this library because there are limitations with both libraries that made them difficult to use in large pre-existing codebases, and don't support certain scenarios such as serializing classes that reference interfaced types (ProtoBuf has some support for this using ProtoInclude). They both also require at least minimal decoration of your classes in order to perform serialization. AnySerializer requires no decoration out of the box and can understand complicated schema arrangements, circular references, etc. It even deals with types that define delegates and events (though don't expect that to get serialized!).
Getting started with AnySerializer is very simple:
using AnySerializer;
var originalObject = new SomeComplexTypeWithDeepStructure();
var bytes = Serializer.Serialize(originalObject);
var restoredObject = Serializer.Deserialize<SomeComplexTypeWithDeepStructure>(bytes);
I'm very interested in expanding unsupported scenarios. If you find that AnySerializer isn't working for you please file a new issue and I'll work towards adding support for it immediately. To be of most assistance please include a class example that I can use to reproduce the issue.