title: How to get index by using XmlDocument functions? C#
body: <p>I created a C# Web Form Application, and I want to get index from specific object. This is what I have for now. In this exercise, I want to input login name and password in order to get info from that specific person. Duplicated name/password is allowed. What I can think of is get index from nodes, and then use <code>XmlNodeList info = reader.GetElementsByTagName("Info");</code> and <code>textBox1.Text = root.GetElementsByTagName("Info")[index].InnerText;</code> I need to find that specific index, but I feel a little bit confuse about that. Hope someone can give me any suggestions, and new idea on how to do it, thank you!</p>
  
  <pre><code>private int GetIndex(string loginname, string password)
  {
      reader = new XmlDocument();
      reader.Load(@filepath);
      XmlNodeList loginN = reader.GetElementsByTagName("Loginname");
      XmlNodeList Pass = reader.GetElementsByTagName("Password");
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Authentication&gt;
    &lt;User xmlns=""&gt;
      &lt;Loginname&gt;Admin&lt;/Loginname&gt;
      &lt;Password&gt;232&lt;/Password&gt;
      &lt;Info&gt;Hello, I'm first person&lt;/Info&gt;
    &lt;/User&gt;
    &lt;User xmlns=""&gt;
      &lt;Loginname&gt;Admin&lt;/Loginname&gt;
      &lt;Password&gt;4445&lt;/Password&gt;
      &lt;Info&gt;Hello, I'm second person&lt;/Info&gt;
    &lt;/User&gt;
  &lt;/Authentication&gt;
  </code></pre>