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 中定義的實體類型或複雜型別的 。

適用於

另請參閱