I'm trying to write an XmlDocument from an instance of a class to pass to BizTalk (2006 R2, if it matters). I'm implementing IXmlSerializable because I believe it'll give me the most flexibility (this object won't necessarilly always be written to an XmlDocument and passed to BizTalk).
So, I have implemented IXmlSerializable, and now I'd like to use the Write() method to create the actual XmlDocument instance to be passed to BizTalk. Something like:
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(XmlWriter.Create(this.Write());
Obviously the above doesn't work: I'm pretty sure it doesn't even compile... but that's the functionality I'm looking for.
Does anyone have a canned solution for this, or a place I can go to look for examples or a tutorial?