Showing posts with label IEnumerable. Show all posts
Showing posts with label IEnumerable. Show all posts

Monday, June 3, 2013

IEnumerable Vs IQueryable

IQueryable

The
IQueryable interface allows the objects to be queried based on the LINQ-to-SQL. Objects which implement the IQuerieable interface can be further queried using LINQ queries and these additional queries will be executed on the underlying data source.

The below line first queries the list of employees from the datasource, the resultant object empList is further queried based on the department name of the employee, both the filters are done in the underlying datasource and only the final list of employees belonging to the sales department are returned and stored in the memory, using LINQ-to-Sql. Hence more efficient based on
IEnumerable based objects.

Sunday, June 2, 2013

IEnumerable Interface

The IEnumerable interface exposes the enumerator, which supports a simple iteration over a non-generic collection.

Namespace:  System.Collections