title: How to filter Directory.EnumerateFiles with specific extension
body: <p>I want a list of all xml files in a folder like this:</p>
  
  <pre><code>foreach (var file in Directory.EnumerateFiles(folderPath, "*.xml"))
  {
      // add file to a collection
  }
  </code></pre>
  
  <p>However, if I for some reason have any files in <code>folderPath</code> that ends with <code>.xmlXXX</code> where <code>XXX</code> represent any characters, then they will be part of the enumerator.</p>
  
  <p>If can solve it easily by doing something like</p>
  
  <pre><code>foreach (var file in Directory.EnumerateFiles(folderPath, "*.xml").Where(x =&gt; x.EndsWith(".xml")))
  </code></pre>
  
  <p>But it seems a bit odd to me, as I basically have to search for the same thing two times. Is there any way to get the right files directly or am I doing something wrong?</p>