title: Linq memory question
body: <p>As I am rather new to linq, I'd like to ask if my understanding is correct in the following example.</p>
  
  <p>Let's assume that I have very large collection of animal names (100k records), I'd like to filer them and process the filtered items in a very time consuming method(2 weeks). The methods <code>RunWithLinq()</code> and <code>RunWithoutLinq()</code> do completely the same. </p>
  
  <p>Is that true that  using the first method the original(large) collection will stay in memory after leaving the method, and will not be touched by <code>GC</code>, whereas using the linq-less method the collection will be removed by <code>GC</code>?</p>
  
  <p>I'd be grateful for a piece of explanation.</p>
  
  <pre><code>class AnimalProcessor
  {
      private IEnumerable&lt;string&gt; animalsToProcess;
      internal AnimalProcessor(IEnumerable&lt;string&gt; animalsToProcess)
      {
          this.animalsToProcess = animalsToProcess;
      }
      internal void Start()
      {
          //do sth for 2 weeks with the collection
      }
  }
  class Program
  {
      static void RunWithLinq()
      {
          var animals = new string[] { "cow", "rabbit", "newt", "ram" };
          var filtered = from animal in animals
                         where animal.StartsWith("ra")
                         select animal;
          AnimalProcessor ap = new AnimalProcessor(filtered);
          ap.Start();
      }
      static void RunWithoutLinq()
      {
          var animals = new string[] { "cow", "rabbit", "newt", "ram" };
          var filtered = new List&lt;string&gt;();
          foreach (string animal in animals)
              if(animal.StartsWith("ra")) filtered.Add(animal);
          AnimalProcessor ap = new AnimalProcessor(filtered);
          ap.Start();
      }
  }
  </code></pre>