Closed GoogleCodeExporter closed 9 years ago
When you create the Serializer to serialize, pass in the base class type or
typeof(object) as the type, then do the same thing when you create the
serializer to
deserialize. You just need to ensure that the serializer is created the same
way for
both serialization and deserialization. The object type does not have to be the
actual object type of the class your are serializing, just a parent class of
it.
Example:
ChildClass c = new ChildClass(); // extends BaseClass
Serializer serializer = new Serializer(typeof(BaseClass));
string result = serializer.Serialize(c);
...
Serializer serializer = new Serializer(typeof(BaseClass));
ChildClass c = (ChildClass) serializer.Deserialize(someString);
Original comment by elliott....@gmail.com
on 17 Jul 2008 at 1:33
Your output for the above example should look like so:
(ChildClass) {
Prop1: "value"
}
Original comment by elliott....@gmail.com
on 17 Jul 2008 at 1:39
Original comment by elliott....@gmail.com
on 6 Aug 2008 at 7:31
Original issue reported on code.google.com by
supadhy...@gmail.com
on 17 Jul 2008 at 1:24