Question

Proper difference of IEnumreable and IQueryable .

Why this two interface used and when used?

Whats the benefit used over list?

What other methods consist in IEnumreable and IQueryable?

In what scenario we have to use IEnumreable and IQueryable?

Was it helpful?

Solution

When querying a database, I prefer using a IQueryable because the request is sent when data are needed. I mean this

   var users = (from user in db.Users select user ).AsQueryable();
   //it doesn't load data yet until you write users.ToList(); or users.Count();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top