title: The type arguments for method cannot be inferred from usage error
body: <p>I have a generic method for paging which I am trying to invoke.
  But I am getting a compile time error:
  <em>The type arguments for method cannot be inferred from usage</em></p>
  
  <p><strong>Method:</strong></p>
  
  <pre><code>public static IQueryable&lt;T&gt; OrderedPagedResults&lt;T, TResult, TType&gt;(IQueryable&lt;T&gt; query, int pageNum, int pageSize,
                          Expression&lt;Func&lt;T, TResult&gt;&gt; orderByProperty, bool isAscendingOrder, out int rowsCount,
                          List&lt;KeyValuePair&lt;Expression&lt;Func&lt;T, TType&gt;&gt;, bool&gt;&gt; lstThenByConditions = null)
          {
              if (pageSize &lt;= 0) pageSize = 20;
  
              rowsCount = query.Count();
  
              if (rowsCount &lt;= pageSize || pageNum &lt;= 0) pageNum = 1;
  
              var excludedRows = (pageNum - 1) * pageSize;
  
              query = isAscendingOrder ? query.OrderBy(orderByProperty) : query.OrderByDescending(orderByProperty);
  
              if (lstThenByConditions != null &amp;&amp; lstThenByConditions.Any())
              {
                  foreach (var thenByProperty in lstThenByConditions)
                  {
                      if (!thenByProperty.Equals(default(KeyValuePair&lt;Expression&lt;Func&lt;T, TType&gt;&gt;, bool&gt;))
                          &amp;&amp; (typeof(IOrderedQueryable&lt;T&gt;).IsAssignableFrom(query.Expression.Type)))
                      {
                          query = thenByProperty.Value
  
                              ? (query as IOrderedQueryable&lt;T&gt;).ThenBy(orderByProperty)
  
                              : (query as IOrderedQueryable&lt;T&gt;).ThenByDescending(orderByProperty);
                      }
                  }
              }
  
              return query.Skip(excludedRows).Take(pageSize);
          }
  </code></pre>
  
  <p>I am trying to invoke this as:</p>
  
  <pre><code>var resultset = OrderedPagedResults(employees, pageNum, rowNum,
                                  o =&gt; o.JoiningDate, isSortAscending, out totalRows);
  </code></pre>
  
  <p>where employees = IQueryable
  Due to some reason I am getting this compile time error and I am not able to invoke this.</p>
  
  <p>Any suggestion what I am missing here?</p>