title: IEnumerable from LINQToSQL, where data is stored before/ and during iteration / .NET
body: <p>I have read a lot of questions/answers here , but I don´t get it.</p>
  
  <p>In case you are using LINQtoSQL</p>
  
  <pre><code>IEnumerable&lt;Car&gt; CarsInSale= context.Cars.Where(x=&gt; x.Model=="Ferrari");
  
  foreach(Car car in CarsInSale)
      Console.WriteLine("Car:" + car.Price);
  </code></pre>
  
  <p>Imagine the query fecthes around 1000 cars in the CarsInSale variable. 
  I want to know what happens in memory inside the app running the query:</p>
  
  <ul>
  <li>A) Until foreach line, memory usage remains unaffected , right? (defered execution)</li>
  <li>B) Once foreach call is done, all the cars are stored in memory? If answer is NO, where the cars are placed? because it has to be somewhere. I imagine each foreach loop don't hit the database...but give some light here please.</li>
  <li>C) Imagine I am wrong in point B. Each foreach loop hits the database, isn't that so inefficient if the database has some kind of delay (a lots of round trips)? wouln't be much better to retrieve all the data at once and store it in memory?</li>
  </ul>
  
  <p>Many thanks, you are awesome.</p>