Why use AsQueryable() instead of List()?

AsQueryable just creates a query, the instructions needed to get a list. You can make futher changes to the query later such as adding new Where clauses that get sent all the way down to the database level.

AsList returns an actual list with all the items in memory. If you add a new Where cluse to it, you don’t get the fast filtering the database provides. Instead you get all the information in the list and then filter out what you don’t need in the application.

So basically it comes down to waiting until the last possible momment before committing yourself.

Leave a Comment