Some people (like myself) should learn not to touch a compiler on Monday mornings (before the third cup of coffee at least)
I don't know why I couldn't remember how to do this, but I feel like a noob.
I was just trying to build a Xml Document in memory with a XmlWriter and a MemoryStream simple stuff right?
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent =
true;
settings.OmitXmlDeclaration =
false;
MemoryStream strm = new MemoryStream();
using (XmlWriter w = XmlWriter.Create(strm, settings)) {
...
}
Now what if you want to get that back into a string? Say for use in a web-service query or something. like, I don't know, the SharePoint 2003 Search Web Service.
That conversion back to a string might look something like this.
string s;
System.O.MemoryStream ms;
System.IO.StreamReader sr = new System.IO.StreamReader(ms));
s = sr.ReadToEnd();
sr.Close();
ms.Close();
Of course later in the day, I decided to actually download the Research Service SDK, grab a copy of the QueryPacket Schema I was working against, generated a class against it with the XSD tool, and subclassed it to make sure I was submitting a valid search request. All was well with the world again, and I didn't feel so horribly inept for a Monday morning. Yeah me!