I found some code that was not correctly wrapping XMLTextWriter and StringWriter with the using clauses. As I'm correcting it, I stumbled on a interesting question:
do I have to explicitly add calls to Close() on each writer or does XMLTextWriter handle calling Close() on StringWriter instance automatically?
using (StringWriter stringWriter = new StringWriter(sb))
{
using (XmlTextWriter writer = new XmlTextWriter(stringWriter))
{
writer.Flush();
writer.Close();
}
// is stringWriter.Close(); required here?
}
Thnx Matt