Articles → CSHARP → Difference between the IQueryable and IEnumerable in C#

Difference between the IQueryable and IEnumerable in C#






Ienumerable


  1. IEnumerable is an interface in the System.Collections namespace.
  2. IEnumerable is suitable for in-memory collections such as arrays, lists, and other collection types.
  3. IEnumerable retrieves all the data from the data source into memory before applying filters.
  4. IEnumerable is suitable for LINQ to Object and LINQ to SQL.

Iqueryable


  1. IQueryable is defined in the System.Linq namespace.
  2. IQueryable is suitable for remote data sources, such as databases and services.
  3. IQueryable executes filtering on the data source, retrieving only the required data.
  4. IQueryable is well-suited for LINQ to SQL.



Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, February 24, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250