Serialization Issues
1) XmlSerializer is slow --- There is a once-per-process-per-type overhead with XmlSerializer. So the first time you serialize or deserialize an object of a given type in an application, there is a significant delay.
2) XmlSerializer will refuse to serialize instances of any class that implements IDictionary, e.g. Hashtable. SoapFormatter and BinaryFormatter do not have this restriction.
3)
XmlSerializer needs to know in advance what type of objects it will find in an ArrayList. To specify the type, use the XmlArrayItem attibute like this: public class Person
{
public string Name;
public int Age;
}
public class Population
{
[XmlArrayItem(typeof(Person))] public ArrayList People;
}
Else InvalidOperationException is thrown

0 Comments:
Post a Comment
<< Home