C# XML serialization of derived classes
[XmlInclude(typeof(Square))] public abstract class Shape {…} (repeat for all known subtypes) If the types are only known at runtime, you can supply them to the XmlSerializer constructor, but: then it is important to cache and reuse that serializer instance; otherwise you will haemorrhage dynamically created assemblies. It does this automatically when you use the constructor … Read more