title: IEnumerable lambda expression for Where()
body: <p>following code works on a collection of type <code>IQueryable</code>:</p>
  
  <p><code>Expression&lt;Func&lt;Activity, bool&gt;&gt; filter = e =&gt; e.IsDeleted &amp;&amp; e.CategoryId == 1;</code></p>
  
  <p>But this expression doesn't work on collections of type <code>IEnumerable</code>.</p>
  
  <p>How I have to modify my expression to get it working?</p>
  
  <p>In my real scenario, my collection object is a navigation property of an entity framework model class: <code>person.Activities.Where(filter);</code></p>
  
  <p>These are the errors:</p>
  
  <pre><code>Error 1
  Instance argument: cannot convert from 'System.Collections.Generic.ICollection&lt;Application.Models.Activity&gt;' to 'System.Linq.IQueryable&lt;Application.Models.Activity&gt;'
  
  Error 2
  'System.Collections.Generic.ICollection&lt;Application.Models.Activity&gt;' does not contain a definition for 'Where' and the best extension method overload 'System.Linq.Queryable.Where&lt;TSource&gt;(System.Linq.IQueryable&lt;TSource&gt;, System.Linq.Expressions.Expression&lt;System.Func&lt;TSource,bool&gt;&gt;)' has some invalid arguments
  </code></pre>