[Mono-devel-list] XmlSerializer design problems

Miguel de Icaza miguel at ximian.com
Tue Aug 24 03:53:22 EDT 2004


> Save is no problem, but I have no idea how to write Load method.
> Serializer.Deserialize just returns new instance. That means you always need
> some object "above" to create instances or static method.

Use a factory pattern:

class Demo {
	public static Demo Load (Stream s)
		XmlSerializer s = new XmlSerializer (typeof (Demo));
		return (Demo) serializer.Deserialize (fs);

More information about the Mono-devel-list mailing list