title: C# XPathSelectElement() when there are multiple matches
body: <p>We're getting unexpected results in an application I support, because the code is calling XPathSelectElement() on a path that matches multiple items. To illustrate:</p>
  
  <pre><code>XElement e = XElement.Parse(@"&lt;root&gt;
                                  &lt;child ID="123"&gt;A&lt;/child&gt;
                                  &lt;child ID="234"&gt;B&lt;/child&gt;
                                &lt;/root&gt;");
  Console.Out.WriteLine(e.XPathSelectElement("//child").Value);
  </code></pre>
  
  <p>In this simple case, it's returning "A". In our more complex production code, it seems to be returning the last match.</p>
  
  <p>To be clear, I'm going to fix this bug with extra filtering in the XPath to make the query result unique. I don't want to depend on misusing the XPathSelectElement() method.</p>
  
  <p><strong>However,</strong> I'd like to be sure I understand what it's currently (incorrectly) doing. I haven't been able to find any documentation on what the expected behavior is in this case. Or is this just a non-standard behavior that you can't expect to behave consistently across environments/versions/etc?</p>