title: LINQ error : The query results cannot be enumerated more than once
body: <p><br>
  I am working on a LINQ function in which I am using ToList() inside a for loop. At the 1st iteration it works fine but then onward it throws an exception as </p>
  
  <blockquote>
    <p>"The query results cannot be enumerated more than once."</p>
  </blockquote>
  
  <p>The sample code is;
  <br></p>
  
  <pre><code>for()
  {
       functionCall();
  }
  
  functionCall()
  {
     var query = &lt;&lt;query logic&gt;&gt;;
     query.ToList();
  }
  </code></pre>
  
  <p>I searched a lot to fix this but everyone is saying use ToList();
  And I am getting error on ToList() itself.
  <br>
  Please help me out to resolve this issue.</p>
  
  <p><br>Thanks in advance</p>