Udostępnij za pośrednictwem


Paging Methods (LINQ to Entities)

A number of the LINQ paging methods are not supported in LINQ to Entities queries. For more information, see Standard Query Operators in LINQ to Entities Queries. The following table lists the supported and unsupported paging methods.

Supported and Unsupported Methods

Method Support Visual Basic function signature C# method signature

ElementAt

Not supported

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

ElementAtOrDefault

Not supported

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

First

Supported

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

First

Supported

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

Supported

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

FirstOrDefault

Supported

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

Not supported

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

Last

Not supported

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

Not supported

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

LastOrDefault

Not supported

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

Not supported

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

Single

Not supported

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

Not supported

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

SingleOrDefault

Not supported

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

Supported

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

Not supported

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

Not supported

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

Supported

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

Not supported

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

Not supported

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
)

See Also

Concepts

Supported and Unsupported Methods (LINQ to Entities)