eZeeNow.com

it's your's

What is the Difference between IEnumerable vs IQueryable?

Many developers get confused with IEnumerable and IQueryable. Both looks similar but there are major difference between these. One will execute in the server memory and another one will execute on the SQL Server(Lazy load) with the filter.

IEnumerable :

While querying data from database, IEnumerable execute select query on server side, load data in-memory on client side and then filter data. Hence does more work and becomes slow.
Doesn't Support custom Query.
Doesn't support Lazy loading.
It is in-Memory.
Extension methods supported in IEnumerable takes functional objects.

IQueryable:

While querying data from database, IQueryable execute select query on server side with all filters. Hence Query becomes fast..
It does support Custom Query by using CreateQuery and Execute methods
It does support Lazy Loading
Extension methods supported in IEnumerable takes expression objects i.e. expression tree.

When and where to use IQueryable and IEnumerable?

IEnumerable can be used while querying data from in-memory collections like List, Array etc. Where as IQueryable can be used querying data from out-memory (like remote database, service) collections.

Comments (5) -

  • kano nelajobs

    8/4/2018 6:00:25 PM | Reply

    Rattling  superb   information can be found on  site . "I said I didn't want to run for president. I didn't ask you to believe me." by Mario M Cuomo.

  • alljobspo Ghana

    8/6/2018 12:20:41 AM | Reply

    Utterly composed content, Really enjoyed looking through.

  • nelajobs abia

    10/5/2018 4:52:34 AM | Reply

    Enjoyed  looking through  this, very good stuff,  regards . "It requires more courage to suffer than to die." by Napoleon Bonaparte.

  • campuzhit book

    11/19/2018 3:31:08 AM | Reply

    I am no longer sure where you are getting your information, but good topic. I needs to spend some time finding out much more or working out more. Thank you for great information I used to be searching for this information for my mission.

  • campuzhit news

    11/19/2018 5:46:50 AM | Reply

    Hey there! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing many months of hard work due to no data backup. Do you have any solutions to protect against hackers?

Loading