IQueryable<T> Interface
System.LinqRepresents a query that, when executed, can be enumerated. This interface is used to write LINQ queries that can be translated into other query languages or data sources.
Syntax
public interface IQueryable<out T> : IEnumerable<T>, IQueryable
Type Parameters
T
: The type of the elements of the sequence. Theout
keyword indicates that this is a contravariant type parameter.
Inheritance
IQueryable<T>
inherits from:
IEnumerable<T>
IQueryable
Remarks
The IQueryable<T>
interface represents a LINQ query that can be translated into a query that executes against a data source.
This is achieved by implementing the IQueryProvider
, which is responsible for translating the query tree into an executable query.
Implementations of IQueryable<T>
typically represent collections of data, such as databases or in-memory collections, and allow for deferred execution of queries.
Methods
GetEnumerator()
IEnumerator<T> GetEnumerator()
Returns an enumerator that iterates through the collection.
Properties
Provider
IQueryProvider Provider { get; }
Gets the element at the specified index in the sequence.
Expression
Expression Expression { get; }
Gets the expression tree that is associated with the data source.