ThankGodItsFriday
Programmer
Hi!
I'd like to serialize an object from within itself.
the code
Generates the runtime error "An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll"
Is this possible to do w/o creating a copy of the current object and serialize that?
I'd like to serialize an object from within itself.
Code:
public class person
{
public int id = 5;
public ArrayList phoneNumbers;
...
public void Serialize (string filename)
{
//Code to serialize current object
}
}
the code
Code:
XmlSerializer serializer = new XmlSerializer(typeof(Whatever));
...
serializer.Serialize(writer, this);
Generates the runtime error "An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll"
Is this possible to do w/o creating a copy of the current object and serialize that?