XML C#

using System;
using System.IO;
using System.Xml;
public class Sample
{
  public static void Main()
  {
     XmlTextWriter writer = null;
     writer = new XmlTextWriter (Console.Out);
     writer.Formatting = Formatting.Indented;
     writer.Indentation = 4;
     writer.WriteStartElement("book");
     writer.WriteStartElement("title");
     writer.WriteString("C#");
     writer.WriteEndElement();
     writer.WriteEndElement();
     writer.Close();  
  }
}