title: Create XML attribute in c#
body: <p>I have the following code to write some data in an xml file. It works well but the attributes. I can not create attributes and its value for an element.</p>
  
  <pre><code>//.xml file===========================
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Errors&gt;
     &lt;Error Name="abc" ContactNo="123"&gt;
       &lt;Description&gt;Test&lt;/Description&gt;
    &lt;/Error&gt;
  &lt;/Errors&gt;
  
  // c# code ===========================
  XmlDocument xmlErrors = new XmlDocument();
  xmlErrors.Load(Path.Combine(Application.StartupPath, "Errors.xml"));
  XmlElement subRoot = xmlErrors.CreateElement("Error");
  // subRoot.Attributes[0].Value = "Test 1";
  // subRoot.Attributes[1].Value = "Test 2";
  XmlElement Description = xmlErrors.CreateElement("Description");
  Description.InnerText = currentData.ExamineeName;
  subRoot.AppendChild(Description);
  xmlErrors.DocumentElement.AppendChild(subRoot);
  xmlErrors.Save(Path.Combine(Application.StartupPath, "Errors.xml"));
  </code></pre>
  
  <p>Would you please help me how to create an attribute and its value?
  Thanks.</p>