title: How to EnumerateFiles with all subdirectories with C# DirectoryInfo?
body: <p>I found this code that gets an array of files out of a <code>DirectoryInfo</code> :</p>
  
  <pre><code>FileInfo[] fileInfoArray = di.EnumerateFiles().Where(f =&gt; extensions.Contains(f.Extension.ToLower())).ToArray();
  </code></pre>
  
  <p>But it only searches the direct children of the path of <code>DirectoryInfo</code>. i.e., it does not include grandchildren.</p>
  
  <p>I guess I need to add <code>SearchOption.AllDirectories</code> parameter to somewhere, but where?</p>
  
  <p>I tried : </p>
  
  <pre><code>di.EnumerateFiles(SearchOption.AllDirectories).Where(f =&gt; extensions.Contains(f.Extension.ToLower())).ToArray();
  </code></pre>
  
  <p>But it yields an error.</p>
  
  <p>So how do I search with a pattern, including all subdirectories ?</p>
  
  <p>Thanks for any help !</p>