title: Indentation and new line command for XMLwriter in C#
body: <p>I am writing some data to XML file...but when I open it all the values are in a single line...how can write it in readable format?ie each node in new line and indentation?</p>
  
  <pre><code>FileStream fs = new FileStream("myfile.xml", FileMode.Create);
  
  XmlWriter w = XmlWriter.Create(fs);
  
  w.WriteStartDocument();
  w.WriteStartElement("myfile");                 
  
  w.WriteElementString("id", id.Text);
  w.WriteElementString("date", dateTimePicker1.Text);
  w.WriteElementString("version", ver.Text);
  w.WriteEndElement();
  w.WriteEndDocument();
  w.Flush();
  fs.Close();
  </code></pre>