IEnumerable | IQueryable | |
Namespace | System.Collections Namespace | System.Linq Namespace |
Derives from | No base interface | Derives from IEnumerable |
Deferred Execution | Supported | Supported |
Lazy Loading | Not Supported | Supported |
How does it work | IEnumerable is suitable just for iterate through collection and you can not modify (Add or Remove) data IEnumerable bring ALL data from server to client then filter them, assume that you have a lot of records so IEnumerable puts overhead on your memory. | Whenever we encounter to huge data with so many records so we have to reduce overhead from application. IQueryable prepares high performance in such situations (huge data) by filtering data firstly and then sending filtered data to client. |
Suitable for | LINQ to Object and LINQ to XML queries. | LINQ to SQL queries. |
Custom Query | Doesn’t supports. | Supports using CreateQuery and Execute methods. |
Extension mehtod parameter |
Extension methods supported in IEnumerable takes functional objects. | Extension methods supported in IEnumerable takes expression objects i.e. expression tree. |
When to use | when querying data from in-memory collections like List, Array etc. | when querying data from out-memory (like remote database, service) collections. |
Best Uses | In-memory traversal | Paging |
For more visit this.
@mvc4beginner
You can use it as :
MVC4example
Please follow the link:
http://guysherman.com/2013/04/12/asp-net-mvc4-binding-to-a-list-of-complex-types/
Nice post !!
how to use these examples in MVC 4 ?
thanks !!