XML C#

using System;
using System.IO;
using System.Xml;
public class Sample {
  public static void Main() {
     XmlWriterSettings settings = new XmlWriterSettings();
     settings.ConformanceLevel = ConformanceLevel.Fragment;
     settings.Indent = true;
     XmlWriter writer = XmlWriter.Create(Console.Out, settings);
     writer.WriteStartElement("book");
     writer.WriteElementString("title", "C#");
     writer.WriteEndElement();
     writer.Flush();
     writer.WriteStartElement("cd");
     writer.WriteElementString("title", "XML");
     writer.WriteEndElement();
     writer.Flush();  
     writer.Close();
  }
}