Using XmlSerializer to serialize derived classes

Viewed 17207

I'm using XMLSerializer to serialize an object that contains a generic list

List <ChildBase> Children {get;set}

The problem is that each element derives from ChildBase which in fact is an abstract class. When I try to deserialize, I get an invalidOperationException

Is there a way I can use XMLSerializer with derived objects? Thanks.

3 Answers

Another option is to set the types dynamically from derived class if defined in another namespace: XmlAttributeOverride

Related