Skip to content
Michael Brown edited this page Dec 2, 2018 · 6 revisions

Welcome to AnySerializer

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.

Installation

Install AnySerializer from the Package Manager Console:

PM> Install-Package AnySerializer

Compatibility

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

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.

Alternatives

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

Getting started with AnySerializer is very simple:

using AnySerializer;

var originalObject = new SomeComplexTypeWithDeepStructure();
var bytes = Serializer.Serialize(originalObject);
var restoredObject = Serializer.Deserialize<SomeComplexTypeWithDeepStructure>(bytes);

Tracking Issues

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.