J
jehugaleahsa
Hello:
I have a memory stream that I am writing XML to. I have a declaration
like this:
MemoryStream memoryStream = new MemoryStream();
using (XmlWriter writer = new XmlTextWriter(new
StreamWriter(memoryStream)))
{
// do something
}
memoryStream.Seek(0, SeekOrigin.Begin); // this is where is fails
return new XmlTextReader(memoryStream);
I have checked the results and the XML is getting written to the
MemoryStream. The problem seems to be that when I leave the using
statement, either XmlTextWriter or the StreamWriter is closing my
MemoryStream.
How do I prevent the automatic close?
Thanks,
Travis
I have a memory stream that I am writing XML to. I have a declaration
like this:
MemoryStream memoryStream = new MemoryStream();
using (XmlWriter writer = new XmlTextWriter(new
StreamWriter(memoryStream)))
{
// do something
}
memoryStream.Seek(0, SeekOrigin.Begin); // this is where is fails
return new XmlTextReader(memoryStream);
I have checked the results and the XML is getting written to the
MemoryStream. The problem seems to be that when I leave the using
statement, either XmlTextWriter or the StreamWriter is closing my
MemoryStream.
How do I prevent the automatic close?
Thanks,
Travis