Serializer.deserialize

Deserializes the given data to value of the given type.

This is the main method used for deserializing data.

  1. T deserialize(Data data, string key)
    class Serializer
    T
    deserialize
    (
    T
    )
    (,
    string key = ""
    )
  2. T deserialize(string key)
  3. T deserialize()

Parameters

T

the type to deserialize the data into

data Data

the serialized untyped data to deserialize

key string

the key associate with the value that was used during serialization. Do not specify a key if no key was used during serialization.

Return Value

Type: T

the deserialized value. A different runtime type can be returned if the given type is a base class.

Throws

SerializationException if an error occurs

Examples

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

auto data = serializer.serialize(1);
auto i = serializer.deserialize!(int)(data);

assert(i == 1);

Meta