Search This Blog

Tuesday, July 23, 2019

Difference Between IQueryable, IEnumerable, And IList In LINQ

 IEnumerable and IQueryable, both are interfaces to a .NET collection
 IQueryable is Subset of  IEnumerable  and inheritance IEnumerable 

 IQueryable executed all the filters on the server-side and fetched the records that are matching all conditions and filters


 the filter is not applied on the server side but first, it fetches all the records from the server and applies on the client side


IEnumerable is useful when we want to iterate the collection of objects which deals with in-process memory
Image 2 for IEnumerable vs IQueryable

IQueryable is useful when we want to iterate a collection of objects which deals with ad-hoc queries against the data source or remote database, like SQL Server

Image 3 for IEnumerable vs IQueryable

No comments :