471,354 Members | 1,165 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

Serializing a generics SortedList

Is it possible to serialize SortedList<T,V> or do I need to come up
with my own method to get the data into and out the list? I'm pretty
sure I know that it's "no" I'm just curious if there are any tricks
around.

Here's the error I get when I attempt to serialize a SortedList<T,V>

Unhandled Exception: System.NotSupportedException: The type
System.Collections.S
ortedList is not supported because it implements IDictionary.

Dec 6 '05 #1
2 9817
I should have mentioned that I'm trying to serialize the SortedList
using XmlSerialize not a binaryformatter.

Dec 6 '05 #2
After finding the article on msdn I realize you can't serialize to XML
anything with IDictionary unless you implement your own IXmlSerializer
and I'm just not in the mood, I found a way to do it by copying my
SortedList<T,V> to a List<T> and damm if that didn't do the trick.

I'd still like to know why List<T> can be serialied but SortedList<T,V>
can't.

Dec 6 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by gerrod | last post: by
4 posts views Thread by Dave Veeneman | last post: by
2 posts views Thread by Pekka | last post: by
2 posts views Thread by Prez | last post: by
4 posts views Thread by SHEBERT | last post: by
6 posts views Thread by n3tx | last post: by
2 posts views Thread by Phil Galey | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.