-
Notifications
You must be signed in to change notification settings - Fork 1
Create ShapeshifterSerializer
Csaba Nemes edited this page Jan 16, 2015
·
2 revisions
The simplest way is to create an instance of ShapeshifterSerializer using the generic class with parameterless constructor.
var serializer = new ShapeshifterSerializer<MyClass>();
The serializer will walk the object graph starting with MyClass to process all classes which needs to be serialized/deserialized. It also looks for custom serializers and deserializers ([Deserializer] and [Serializer] attributes on methods) in these classes.
If a type can not be detected during the graph walk you must specify it as a known type when constructing the serializer.
var serializer = new ShapeshifterSerializer<MyClass>(new[] { typeof(CustomDeserializersForV4) });
Specifying known types is needed if the custom deserializer is in a separate class, or if you use object as type for a serialized field.
See Advanced Topics when to use descendant search assemblies.