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

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
 
M

Marc Gravell

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

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top