IQueryable Interface


提供功能,對未指定資料類型的特定資料來源評估查詢。Provides functionality to evaluate queries against a specific data source wherein the type of the data is not specified.

public interface class IQueryable : System::Collections::IEnumerable
public interface IQueryable : System.Collections.IEnumerable
type IQueryable = interface
    interface IEnumerable
Public Interface IQueryable
Implements IEnumerable


IQueryable 介面是供查詢提供者執行。The IQueryable interface is intended for implementation by query providers. 它只應該由也會實作為 IQueryable<T>的提供者來執行。It is only supposed to be implemented by providers that also implement IQueryable<T>. 如果提供者並未同時執行 IQueryable<T>,則標準查詢運算子不能用在提供者的資料來源上。If the provider does not also implement IQueryable<T>, the standard query operators cannot be used on the provider's data source.

IQueryable 介面會繼承 IEnumerable 介面,因此,如果它代表查詢,則可以列舉該查詢的結果。The IQueryable interface inherits the IEnumerable interface so that if it represents a query, the results of that query can be enumerated. 列舉會使與 IQueryable 物件相關聯的運算式樹狀架構執行。Enumeration causes the expression tree associated with an IQueryable object to be executed. 「執行運算式樹狀架構」的定義是查詢提供者特有的。The definition of "executing an expression tree" is specific to a query provider. 例如,它可能牽涉到將運算式樹狀架構轉譯為基礎資料來源的適當查詢語言。For example, it may involve translating the expression tree to an appropriate query language for the underlying data source. 呼叫 Execute 方法時,會執行未傳回可列舉結果的查詢。Queries that do not return enumerable results are executed when the Execute method is called.

如需如何建立您自己的 LINQ 提供者的詳細資訊,請參閱LINQ:建立 IQueryable 提供者For more information about how to create your own LINQ provider, see LINQ: Building an IQueryable Provider.



取得與這個 IQueryable 執行個體關聯的運算式樹狀架構執行時,所傳回項目的型別。Gets the type of the element(s) that are returned when the expression tree associated with this instance of IQueryable is executed.


取得與 IQueryable 之執行個體關聯的運算式樹狀架構。Gets the expression tree that is associated with the instance of IQueryable.


取得與這個資料來源關聯的查詢提供者。Gets the query provider that is associated with this data source.



傳回逐一查看集合的列舉值。Returns an enumerator that iterates through a collection.

(Inherited from IEnumerable)

Extension Methods


IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.


根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.


啟用查詢的平行化作業。Enables parallelization of a query.


IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.


IQueryable 的項目轉換為指定的型別。Converts the elements of an IQueryable to the specified type.


根據指定的型別來篩選 IQueryable 的項目。Filters the elements of an IQueryable based on a specified type.

Applies to

See also