Why doesn't XmlSerializer support Dictionary?

Posted by theburningmonk on Stack Overflow See other posts from Stack Overflow or by theburningmonk
Published on 2010-05-26T09:08:44Z Indexed on 2010/05/26 9:11 UTC
Read the original article Hit count: 299

Filed under:
|
|
|

Just curious as to why Dictionary is not supported by XmlSerializer?

You can get around it easily enough by using DataContractSerializer and writing the object to a XmlTextWriter, but what are the characteristics of a Dictionary that makes it difficult for a XmlSerializer to deal with considering it's really an array of KeyValuePairs.

In fact, you can pass an IDictionary<TKey, TItem> to a method expecting an IEnumerable<KeyValuePairs<TKey, ITem>>.

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml