How to serialize a collection of base type and see the concrete types in easy to read XML
- by Jason Coyne
I have a List which is populated with objects of various concrete types which subclass BaseType
I am using the WCF DataContractSerializer
<Children>
<BaseType xmlns:d3p1="http://schemas.datacontract.org/2004/07/Tasks"
i:type="d3p1:ConcreteTypeA"></BaseType>
<BaseType xmlns:d3p1="http://schemas.datacontract.org/2004/07/Tasks"
i:type="d3p1:ConcreteTypeB"></BaseType>
</Children>
Is there any way to get this to generate
<Children>
<ConcreteTypeA/>
<ConcreteTypeB/>
</Children>
?
The real goal is to let users generate some XML to load into memory, and the users are of a skill level that asking them for the original XML is not going to be successful.