Collection property serialization with DataContractSerializer takes us a step backwards?

Since I have to define my fault details with DataContractSerializer attributes for now (I hope it’s only for now anyway), I was looking at how to translate a property that was previously serialized by the XmlSerializer using XmlArrayAttribute and XmlArrayItemAttribute. Well, I figured out pretty quick there was no equivalent, found CollectionDataContractAttribute, but thought “noooo, this can’t be the only way… can it?”. Unfortunately a quick search revealed this post by Christian Weyer that confirmed my fears. Why oh why do I have to go writing a whole new collection class now just to decorate it with attributes when I could decorate the member itself?

Argh… there’s nothing more frustrating than seeing an API try to re-invent the wheel and end up with something that is worse off than what we have today. 🙁

One thought on “Collection property serialization with DataContractSerializer takes us a step backwards?

  1. I’m so glad I’m not the only one to think data contracts are on the “sucky” side of an otherwise excellent platform.Yes, pretty much everything about the DataContractSerializer feels like a step backwards from good ol’ trusty XmlSerializer to me…

Leave a Reply