title: Type arguments cannot be inferred from usage
body: <p>I'm fairly new to generics so I wonder if somebody can explain the following problem I'm having. In virtually all my controllers in an ASP.NET MVC application I need to return a filtered list (to populate a JqGrid as it happens where the user will have specified certain filtering criteria). Each controllers list method will return a different IQueryable list so I set about creating a generic method to handle this.</p>
  
  <p>While I was creating my method I defined it in a specific controller. Everything compiled and I got the results I expected. Because I want to call this method from all my controllers I assumed I could simply create another static class, put the method in there and then call that method from all my controllers. But if I try to move the method to anywhere else other than the controller thats calling it, the compiler complains about the last line of the method with the following error:</p>
  
  <p><em>The type arguments for method <code>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;)</code> 
  cannot be inferred from the usage. 
  Try specifying the type arguments explicitly.</em>  </p>
  
  <pre><code>public static IQueryable&lt;T&gt; FilteredList&lt;T&gt;(IQueryable&lt;T&gt; list, string filters)
  {
       var qb = new QueryBuilder&lt;T&gt;();
       var whereClause = qb.BuildWhereClause(filters);
       return list.Where(whereClause);
  }
  </code></pre>
  
  <p>I've tried <code>list&lt;T&gt;.Where(whereClause)</code> and <code>list.Where&lt;T&gt;(whereClause)</code> and just about every other combination, can anyone explain to me where I'm going wrong.</p>