ObjectQuery<T>.OfType<TResultType> 方法

定義

將查詢限制為只有特定類型的結果。

public:
generic <typename TResultType>
 System::Data::Objects::ObjectQuery<TResultType> ^ OfType();
public System.Data.Objects.ObjectQuery<TResultType> OfType<TResultType>();
member this.OfType : unit -> System.Data.Objects.ObjectQuery<'ResultType>
Public Function OfType(Of TResultType) () As ObjectQuery(Of TResultType)

類型參數

TResultType

當查詢執行並套用該篩選器時,所回傳的 ObjectResult<T> 類型。

傳回

ObjectQuery<TResultType>

一個與原始實例相同的新 ObjectQuery<T> 實例,且套用了 OFTYPE

例外狀況

指定的類型不適用。

備註

OfType 用於依照特定實體或複雜型別來篩選查詢結果。 這支持一個具有物件繼承的概念模型。 如需詳細資訊,請參閱 實體數據模型:繼承

OfType 方法只能應用於 ObjectQuery<T> EDM 中定義的實體類型或複雜型態。

適用於

另請參閱