title: What is the purpose of AsQueryable()?
body: <p>Is the purpose of <code>AsQueryable()</code> just so you can pass around an <code>IEnumerable</code> to methods that might expect <code>IQueryable</code>, or is there a useful reason to represent <code>IEnumerable</code> as <code>IQueryable</code>? For example, is it supposed to be for cases like this:</p>
  
  <pre><code>IEnumerable&lt;Order&gt; orders = orderRepo.GetAll();
  
  // I don't want to create another method that works on IEnumerable,
  // so I convert it here.
  CountOrders(orders.AsQueryable());
  
  public static int CountOrders(IQueryable&lt;Order&gt; ordersQuery)
  {
      return ordersQuery.Count();
  }
  </code></pre>
  
  <p>Or does it actually make it do something different:</p>
  
  <pre><code>IEnumerable&lt;Order&gt; orders = orderRepo.GetAll();
  IQueryable&lt;Order&gt; ordersQuery = orders.AsQueryable();
  
  IEnumerable&lt;Order&gt; filteredOrders = orders.Where(o =&gt; o.CustomerId == 3);
  IQueryable&lt;Order&gt; filteredOrdersQuery = ordersQuery.Where(o =&gt; o.CustomerId == 3);
  
  // Are these executed in a different way?
  int result1 = filteredOrders.Count();
  int result2 = filteredOrdersQuery.Count();
  </code></pre>
  
  <p>Do the <code>IQueryable</code> versions of these extension methods just build up an Expression that ends up doing the same thing once its executed? My main question is, whats a real use case for using <code>AsQueryable</code>?</p>