Articles → CSHARP → Difference between the IQueryable and IEnumerable in C#
Difference between the IQueryable and IEnumerable in C#
Ienumerable
- IEnumerable is an interface in the System.Collections namespace.
- IEnumerable is suitable for in-memory collections such as arrays, lists, and other collection types.
- IEnumerable retrieves all the data from the data source into memory before applying filters.
- IEnumerable is suitable for LINQ to Object and LINQ to SQL.
Iqueryable
- IQueryable is defined in the System.Linq namespace.
- IQueryable is suitable for remote data sources, such as databases and services.
- IQueryable executes filtering on the data source, retrieving only the required data.
- IQueryable is well-suited for LINQ to SQL.
| Posted By - | Karan Gupta |
| |
| Posted On - | Wednesday, February 24, 2021 |