What’s the difference(s) between .ToList(), .AsEnumerable(), AsQueryable()?

I know some differences of LINQ to Entities and LINQ to Objects which the first implements IQueryable and the second implements IEnumerable and my question scope is within EF 5.

My question is what’s the technical difference(s) of those 3 methods? I see that in many situations all of them work. I also see using combinations of them like .ToList().AsQueryable().

  1. What do those methods mean, exactly?

  2. Is there any performance issue or something that would lead to the use of one over the other?

  3. Why would one use, for example, .ToList().AsQueryable() instead of .AsQueryable()?

4 Answers
4

Leave a Comment