top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What are the differences between IEnumerable and IQueryable in C#?

0 votes
436 views
What are the differences between IEnumerable and IQueryable in C#?
posted Mar 31, 2017 by Amit Sharma

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

IEnumerable:
1. It belongs to System.Collections namespace.
2. IEnumerable is the best way to write query on collections data type like list,array etc.
3. IEnumerable is the return type for LINQ to object and LINQ to XML queries.
4. IEnumerable does not support lazy loading.So it's not recommended approach for paging scenarios.
5. It supports extension methods.

IQueryable
1. IQueryable belongs to System.Linq namespace.
2. IQueryable is the best way to write query on data like remote database,service collections etc.
3. IQueryable is the return type for LINQ to SQL queries.
4. IQueryable support lazy loading.So it can be used for paging scenarios.

answer Mar 31, 2017 by Shweta Singh
...