Flush what is in the buffer to the underlying streams and flush the underlying stream.
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlTextWriter writer = new XmlTextWriter (Console.Out);
writer.Formatting = Formatting.Indented;
writer.WriteStartElement("book");
writer.WriteElementString("title", "C#");
writer.WriteEndElement();
writer.Flush();
writer.WriteStartElement("cd");
writer.WriteElementString("title", "Americana");
writer.WriteEndElement();
writer.Flush();
writer.Close();
}
}
Related examples in the same category