Customize DataContractSerializer to use class name as tag nameinstead of base class name + type attr

  • Thread starter Thread starter Achim Domma
  • Start date Start date
A

Achim Domma

Hi,

in my data contract I have a member like this:

[DataMember]
public List<BaseClass> Items { get { ... } }

The property is serialized as a list of <BaseClass> tags with an
i:type attribute. It would be better for me to have <DerivedClass>
tags for the different subclasses. Is there a way to enforce that?

Achim
 
I think that is just how DataContractSerializer works. IIRC, you have
more control in XmlSerializer via XmlArrayItem.

Marc
 
Back
Top