title: Select from IEnumerable using LINQ
body: <p>I have a method that returns an object from cache which I use to populate selectlists within the system.</p>
  
  <pre><code>var r = CacheHelper.GetCacheItem(...);
  return new SelectList((IEnumerable)r, "Id", "Name");
  </code></pre>
  
  <p><code>r</code> is of type <code>System.Collections.Generic.List&lt;&lt;&gt;f__AnonymousType39&lt;string,int,string&gt;&gt;</code></p>
  
  <p>By using <code>IEnumerable enumerable = (IEnumerable)r;</code> I see that
  <code>enumerable</code> looks like this:</p>
  
  <pre><code>[0]: { Name = "Lost", Id = 1, Area = null }
  [1]: { Name = "Found", Id = 2, Area = null }
  [2]: { Name = "Stock Adjustment", Id = 3, Area = null }
  ...
  </code></pre>
  
  <p>I would like to be able to use LINQ toquery the result set to return a subset, while keeping the full list in memory. Something like:</p>
  
  <pre><code>var s = enumerable.Where(x =&gt; x.Area == "myarea");
  </code></pre>
  
  <p>Answers to similar SO questions suggest using ToList(), but I can't call any LINQ methods on <code>enumerable</code> without getting a <code>System.Collections.IEnumerable' does not contain a definition for 'ToList'..</code> error message. (I'm using ToList() elsewhere in the code so I have a valid reference to <code>System.Linq</code>.</p>