How to serialize a collection of base type and see the concrete types in easy to read XML
Posted
by Jason Coyne
on Stack Overflow
See other posts from Stack Overflow
or by Jason Coyne
Published on 2010-04-10T01:03:17Z
Indexed on
2010/04/10
3:03 UTC
Read the original article
Hit count: 388
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.
© Stack Overflow or respective owner