What is the difference between IEnumerable and IQueryable?
- IEnumerable is an interface available in the System.Collection namespace.
- Any collection that implements the IEnumerable makes it iterable.
- The IEnumerable or the Generic IEnumerable must be used over in-memory objects.
- IQueryable is an interface available in the System.Linq namespace and implements IEnumerable
- The IQueryable interface provides the IQueryProvider, which is used to create LINQ providers used in data-centric operations such as LINQ-to-SQL etc.
- By using the AsQueryable() method over a collection, we can convert it into an IQueryable collection.
Posted Apr 30, 2021