public XmlDocument ToXmlDoc()
{
XmlDocument doc = new XmlDocument();
using (Stream memoryStore = new MemoryStream())
{
XmlSerializer xs = new XmlSerializer(typeof(FormSubmission));
XmlWriter xmlWriter = new XmlTextWriter(memoryStore, Encoding.Unicode);
xs.Serialize(xmlWriter, this);
// reset the read postition so .Load() will start at the beginning (instead of last position written to)
memoryStore.Position = 0;
doc.Load(memoryStore);
}
return doc;
}