共用方式為


分頁方法 (LINQ to Entities)

在 LINQ 到實體 查詢中不支援許多 LINQ 分頁方法。如需詳細資訊,請參閱 LINQ to Entities 查詢中的標準查詢運算子。下表所列為支援和不支援的分頁方法。

支援與不支援的方法

方法 支援 Visual Basic 函式簽章 C# 方法簽章

ElementAt

不支援

Function ElementAt(Of TSource) ( _
source As IQueryable(Of TSource), _
index As Integer _
) As TSource
TSource ElementAt<TSource>(
this IQueryable<TSource> source,
int index
)

ElementAtOrDefault

不支援

Function ElementAtOrDefault(Of TSource) ( _
source As IQueryable(Of TSource), _
index As Integer _
) As TSource
TSource ElementAtOrDefault<TSource>(
this IQueryable<TSource> source,
int index
)

First

支援

Function First(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource First<TSource>(
this IQueryable<TSource> source
)

First

支援

Function First(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As TSource
TSource First<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

FirstOrDefault

支援

Function FirstOrDefault(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource FirstOrDefault<TSource>(
this IQueryable<TSource> source
)

FirstOrDefault

支援

Function FirstOrDefault(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As TSource
TSource FirstOrDefault<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

Last

不支援

Function Last(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource Last<TSource>(
this IQueryable<TSource> source
)

Last

不支援

Function Last(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As TSource
TSource Last<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

LastOrDefault

不支援

Function LastOrDefault(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource LastOrDefault<TSource>(
this IQueryable<TSource> source
)

LastOrDefault

不支援

Function LastOrDefault(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As TSource
TSource LastOrDefault<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

Single

不支援

Function Single(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource Single<TSource>(
this IQueryable<TSource> source
)

Single

不支援

Function Single(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As TSource
TSource Single<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

SingleOrDefault

不支援

Function SingleOrDefault(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource SingleOrDefault<TSource>(
this IQueryable<TSource> source
)

SingleOrDefault

不支援

Function SingleOrDefault(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As TSource
TSource SingleOrDefault<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

Skip

支援

Function Skip(Of TSource) ( _
source As IQueryable(Of TSource), _
count As Integer _
) As IQueryable(Of TSource)
IQueryable<TSource> Skip<TSource>(
this IQueryable<TSource> source,
int count
)

SkipWhile

不支援

Function SkipWhile(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As IQueryable(Of TSource)
IQueryable<TSource> SkipWhile<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

SkipWhile

不支援

Function SkipWhile(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Integer, Boolean)) _
) As IQueryable(Of TSource)
IQueryable<TSource> SkipWhile<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, int, bool>> predicate
)

Take

支援

Function Take(Of TSource) ( _
source As IQueryable(Of TSource), _
count As Integer _
) As IQueryable(Of TSource)
IQueryable<TSource> Take<TSource>(
this IQueryable<TSource> source,
int count
)

TakeWhile

不支援

Function TakeWhile(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As IQueryable(Of TSource)
IQueryable<TSource> TakeWhile<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

TakeWhile

不支援

Function TakeWhile(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Integer, Boolean)) _
) As IQueryable(Of TSource)
IQueryable<TSource> TakeWhile<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, int, bool>> predicate
)

另請參閱

概念

支援與不支援的方法 (LINQ to Entities)