What is the difference between IEnumerable , IQueryable , and List in C#? IEnumerable : Used to iterate over a collection. It executes queries in-memory (deferred execution). IQueryable : Supports LINQ queries with deferred execution, but translates them to SQL when working with databases like Entity Framework. List<T> : A concrete data structure that holds elements in memory with immediate execution. Example:
What is the difference between
IEnumerable,IQueryable, andListin C#?IEnumerable: Used to iterate over a collection. It executes queries in-memory (deferred execution).IQueryable: Supports LINQ queries with deferred execution, but translates them to SQL when working with databases like Entity Framework.List<T>: A concrete data structure that holds elements in memory with immediate execution.Example: