IEnumerable<T>
There are many ways that many things can be stored in a list, in an array, in a database, etc. One thing that has common storage mechanisms is that the set of things that can be stored can be Enumerated , each of which can be accessed one by one using a language construct like foreach .
The IEnumerable<T> interface is a common interface that all owners of sets of things must include an enumeration. Therefore, IEnumberable<Person is an interface that allows you to list objects from Person without specific information about the actual way that these objects are stored.
IQueryable<T>
This is an extension for IEnumerable<T> , but it is something specific to LINQ. In LINQ, you can specify a query that can filter and transform a set (or set) of elements. Against the pure IEnumerable<T> interface, this will be known as LINQ to Objects, in which each step of the query is ultimately a simple extension method call.
However, against an object that implements IQueryable<T> , things can be more complex. An object that implements IQueryable<T> can be associated with another LINQ Provider , which can implement the execution of LINQ queries differently. For example, IQueryable<Person> may be implemented by a type associated with the LINQ-To-SQL provider. In this case, the LINQ query is converted to a T-SQL query against the database to obtain a set of elements (the result may not necessarily be a set of Person objects).
AnthonyWJones
source share