Closes this stream and the underlying stream.
using System; using System.IO; using System.Xml; public class Sample { public static void Main() { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.OmitXmlDeclaration = true; XmlWriter writer = XmlWriter.Create(Console.Out, settings); writer.WriteStartElement("book"); writer.WriteStartElement("title"); writer.WriteString("C#"); writer.WriteEndElement(); writer.WriteEndElement(); writer.Close(); } }