By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,733 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,733 IT Pros & Developers. It's quick & easy.

cannot serialize a generic Dictionary

P: n/a
hi,
i am able to serialize a normal generic List<> no problem. But when i
try to serialize a Dictionary<string,string>, i get an exception as
shown below:

"The type System.Collections.Generic.Dictionary[string, string....] is
not supported because it implements IDictionary"

why is it not straight forward to serialize a dictionary, like it is
with a generic List?
what can i do to serialize it? i looked at Dictionary.GetObjectData
but i got stuck trying to fill in the first parameter
"SerializationInfo" which needs an IFormatter, and i presume is asking
me for a specification for how to serialize it, which i don't think i
should have to do just to do this simple thing!

this is the code i'm using the serialize:
XmlSerializer xs = new XmlSerializer(typeof(Dictionary<string,
string>));
xs.Serialize(fs, pList);

thanks for any help
tim

Jan 12 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.