Hi,
Thank you for posting in the community!
Based on my understanding, you want to serialize a class which takes
SortedList in it, but an exception generates.
===========================================
You use Binary Serialization or XmlSerialization?
I think you may use the XmlSerialization. There is an already know issue
about Xml Serialize class that implement IDictionary(Such as HashTable)
This is because XmlSerializer does not support serialization of IDictionary
in this .Net version.
To workaround this issue, you may just use SoapFormatter to serialize your
class, do like this:
using System;
using System.Collections;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Soap;
public class MyClass {
public static void Main() {
SoapFormatter sf = new SoapFormatter();
Hashtable objHashtable = new Hashtable();
objHashtable.Add(1, "Paolo");
objHashtable.Add(2, "Katty");
objHashtable.Add(3, "Marco");
Stream s1 = File.Create("ht.soap");
sf.Serialize(Console.Out, objHashtable);
s1.Close();
}
}
If you still have concern on the un-support of this XmlSerialize function,
you can provide your suggestion to:
http://register.microsoft.com/mswish/suggestion.asp
or mail to: (e-mail address removed)
=====================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.