MarkMacrae
New member
- Joined
- Apr 19, 2006
- Messages
- 1
Hi
Im trying to serialize an object to XML (c#) using the System.XMLSerializer but Im getting exceptions due to the class being an interface (see code snippet below).
string filename = @"C:\Mark\CODAAccount_" + myElement.Code + ".xml";
TextWriter tw = new StreamWriter(filename);
XmlSerializer serializer = new XmlSerializer(typeof(codaElementClass));
serializer.Serialize(tw,myElement);
I have read that there are ways I can implement the ISerializable interface which will allow me to serialize my object, but can anyone help me with this and provide some example syntax??
Thanks
Mark
Im trying to serialize an object to XML (c#) using the System.XMLSerializer but Im getting exceptions due to the class being an interface (see code snippet below).
string filename = @"C:\Mark\CODAAccount_" + myElement.Code + ".xml";
TextWriter tw = new StreamWriter(filename);
XmlSerializer serializer = new XmlSerializer(typeof(codaElementClass));
serializer.Serialize(tw,myElement);
I have read that there are ways I can implement the ISerializable interface which will allow me to serialize my object, but can anyone help me with this and provide some example syntax??
Thanks
Mark