IEnumerable: IEnumerable is best suitable for working with in-memory collection (or local queries).
IEnumerable doesn't move between items, it is forward only collection.
IQueryable: IQueryable best suits for remote data source, like a database or web service (or remote queries).
IQueryable is a very powerful feature that enables a variety of interesting deferred execution scenarios (like paging and composition based queries).
So when you have to simply iterate through the in-memory collection, use IEnumerable, if you need to do any manipulation with the collection like Dataset and other data sources, use IQueryable
In case of IEnumerable, Return LINQ result list and thne execute condition But in IQuerable, which execute condition at the end and return the list
Ienumerable fetches the entire data from the database.It fetches the record one by one.It can Read , but cannot modify and update the data.It is the forward only data,we cannot insert the items at the middle.
IQueryable : IQueryable fetches the Record based on filter wise. IQueryable is faster than IEnumerable.
No comments:
Post a Comment