What is the purpose of AsQueryable()?
问题 Is the purpose of AsQueryable() just so you can pass around an IEnumerable to methods that might expect IQueryable , or is there a useful reason to represent IEnumerable as IQueryable ? For example, is it supposed to be for cases like this: IEnumerable<Order> 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<Order> ordersQuery) { return