blogspot visit counter

Friday, 16 May 2014

Difference between ienumerable and iqueryable in asp.net

MVC asp.net interview questions and answers
Difference b/w IEnumerable and IQuerable

IEnumerable and IQuerable are used to query data from database and collections.  The IEnumerable is basically inherited from IQueryable, so it’s having all the features of the IQueryable in addition to its having additional own features.



Some most common differnece between IEnumerable and IQuerable  as shown below table

S.No IEnumerable
IQueryable
1
Exists in System.Collections Namespace
Exists in System.Linq Namespace
2 Can move to forward only in the collection. Can move to forward, backward or in between the items.
3 Best for collection like List, Array or in-memory collection Best for the collections which is out memory like services, remote databases etc
4 uitable for LINQ to Objet and Linq to XML queries. Suitable for Linq to SQL queries
5 It doesn’t supports custom query, Lazy loading so it’s not good for paging scenarios. It supports custom query using CreateQuery and Execute methods. Also support lazy loading so good for the paging scenarios.
6 The extension methods which supports be IEnumrable takes the functional objects as the parameters. The extension methods which supports be IEnumrable takes the expression tree expressions as the parameters.

1 comment:

  1. Thank you for this brief explanation and ver nice information. well, got a good knowledge. Have a nice idea, this is more helpful to me. This can gives the better performance.
    PPC Services Chennai

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...