| Difference between IQueryable and IEnumerable
There are mainly 4 difference in IQueryable and IEnumberable. Below are the points for the same
(1)IEnumerable Namespace is System.Collections and for IQueryable is is in System.Linq Namespace.
(2)IEnumerable is usefull where we need to do query from in-memory collections for example List, Array and so on. On the other hand IQueryable is usefull where querying data from out-memory for example remote database, service collections.
(3)When doing query in IEnumerable it will firs excute Select Query and load all the data in memory and then apply filter on it is inMemory concept suitable for short data will becaome solw if data is huge. On the other hand Iqueryable is suitable where data is taken in outMemory and all filter should be apply on the server for example Remote Database and Service.
(4)IEnumerable is usefull for LINQ to Object and LINQ to XML queries on the other hand IQueryable is beneficial for LINQ to SQL queries. | | |