title: Auto increment ID value in xml file
body: <p>I want to add a new node to my xml file, but also, i would like to add id value in it, but incremented by 1 from the last value. Here is my XML:</p>
  
  <pre><code>  &lt;users&gt;
        &lt;user&gt;
          &lt;id&gt;1&lt;/id&gt;
          &lt;name&gt;Name1&lt;/name&gt;
          &lt;surname&gt;Surname1&lt;/surname&gt;
          &lt;weight&gt;78&lt;/weight&gt;
          &lt;height&gt;180&lt;/height&gt;
        &lt;/user&gt;
        &lt;user&gt;
          &lt;id&gt;2&lt;/id&gt;
          &lt;name&gt;Name2&lt;/name&gt;
          &lt;surname&gt;Surname2&lt;/surname&gt;
          &lt;weight&gt;84&lt;/weight&gt;
          &lt;height&gt;180&lt;/height&gt;
        &lt;/user&gt;
      &lt;/users&gt;
  </code></pre>
  
  <p>And here is my code so far (for adding a new node):</p>
  
  <pre><code>        XmlNode node = xmlDoc.SelectSingleNode("/users/user");
          XmlNode newNode = xmlDoc.ImportNode(node, true);
          xmlDoc.DocumentElement.AppendChild(newNode);
  
          xmlDoc.SelectSingleNode("users/user/id").InnerText = ; // &lt;-- ??
          xmlDoc.SelectSingleNode("users/user/name").InnerText = nameBox.Text;
          xmlDoc.SelectSingleNode("users/user/surname").InnerText = surnameBox.Text;
          xmlDoc.SelectSingleNode("users/user/weight").InnerText = Convert.ToString(weightUpDown.Value);
          xmlDoc.SelectSingleNode("users/user/height").InnerText = Convert.ToString(heightUpDown.Value);
  </code></pre>
  
  <p>I am using winforms in C#, in this case get the value from the text boxes and UpDown lists.
  How can I do it in c#?</p>