次の方法で共有


Ordering Methods (LINQ to Entities)

Most of the LINQ ordering methods are supported in LINQ to Entities, with the exception of those that accept an IComparer, because the comparer cannot be translated to the data source. For more information, see Standard Query Operators in LINQ to Entities Queries. The following table lists the supported and unsupported ordering methods.

Supported and Unsupported Methods

Method Support Visual Basic function signature C# method signature

OrderBy

Supported

Function OrderBy(Of TSource, TKey) ( _
source As IQueryable(Of TSource), _
keySelector As Expression(Of Func(Of TSource, TKey)) _
) As IOrderedQueryable(Of TSource)
IOrderedQueryable<TSource> OrderBy<TSource, TKey>(
this IQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector
)

OrderBy

Not supported

Function OrderBy(Of TSource, TKey) ( _
source As IQueryable(Of TSource), _
keySelector As Expression(Of Func(Of TSource, TKey)), _
comparer As IComparer(Of TKey) _
) As IOrderedQueryable(Of TSource)
IOrderedQueryable<TSource> OrderBy<TSource, TKey>(
this IQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector,
IComparer<TKey> comparer
)

OrderByDescending

Supported

Function OrderByDescending(Of TSource, TKey) ( _
source As IQueryable(Of TSource), _
keySelector As Expression(Of Func(Of TSource, TKey)) _
) As IOrderedQueryable(Of TSource)
IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(
this IQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector
)

OrderByDescending

Not supported

Function OrderByDescending(Of TSource, TKey) ( _
source As IQueryable(Of TSource), _
keySelector As Expression(Of Func(Of TSource, TKey)), _
comparer As IComparer(Of TKey) _
) As IOrderedQueryable(Of TSource)
IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(
this IQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector,
IComparer<TKey> comparer
)

ThenBy

Supported

Function ThenBy(Of TSource, TKey) ( _
source As IOrderedQueryable(Of TSource), _
keySelector As Expression(Of Func(Of TSource, TKey)) _
) As IOrderedQueryable(Of TSource)
IOrderedQueryable<TSource> ThenBy<TSource, TKey>(
this IOrderedQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector
)

ThenBy

Not supported

Function ThenBy(Of TSource, TKey) ( _
source As IOrderedQueryable(Of TSource), _
keySelector As Expression(Of Func(Of TSource, TKey)), _
comparer As IComparer(Of TKey) _
) As IOrderedQueryable(Of TSource)
IOrderedQueryable<TSource> ThenBy<TSource, TKey>(
this IOrderedQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector,
IComparer<TKey> comparer
) 

ThenByDescending

Supported

Function ThenByDescending(Of TSource, TKey) ( _
source As IOrderedQueryable(Of TSource), _
keySelector As Expression(Of Func(Of TSource, TKey)) _
) As IOrderedQueryable(Of TSource)
IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(
this IOrderedQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector
)

ThenByDescending

Not supported

Function ThenByDescending(Of TSource, TKey) ( _
source As IOrderedQueryable(Of TSource), _
keySelector As Expression(Of Func(Of TSource, TKey)), _
comparer As IComparer(Of TKey) _
) As IOrderedQueryable(Of TSource)
IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(
this IOrderedQueryable<TSource> source,
Expression<Func<TSource, TKey>> keySelector,
IComparer<TKey> comparer
)

Reverse

Not supported

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

See Also

Concepts

Supported and Unsupported Methods (LINQ to Entities)