Serializer.register

Registers the given type for (de)serialization.

This method is used for register classes that will be (de)serialized through base class references, no other types need to be registered. If the the user tries to (de)serialize an instance through a base class reference which runtime type is not registered an exception will be thrown.

class Serializer
static
void
register
(
T : Object
)
()

Parameters

T

the type to register, must be a class

Examples

class Base {}
class Sub : Base {}

Serializer.register!(Sub);

auto archive = new XmlArchive!();
auto serializer = new Serializer(archive);

Base b = new Sub;
serializer.serialize(b);

See Also

registerSerializer registerDeserializer

Meta