Queryable.MaxBy Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
MaxBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>) |
Returns the maximum value in a generic IQueryable<T> according to a specified key selector function. |
MaxBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IComparer<TSource>) |
Returns the maximum value in a generic IQueryable<T> according to a specified key selector function. |
MaxBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>)
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
Returns the maximum value in a generic IQueryable<T> according to a specified key selector function.
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static TSource MaxBy(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, TKey> ^> ^ keySelector);
public static TSource? MaxBy<TSource,TKey> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector);
static member MaxBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> -> 'Source
<Extension()>
Public Function MaxBy(Of TSource, TKey) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey))) As TSource
Type Parameters
- TSource
The type of the elements of source
.
- TKey
The type of key to compare elements by.
Parameters
- source
- IQueryable<TSource>
A sequence of values to determine the maximum value of.
- keySelector
- Expression<Func<TSource,TKey>>
A function to extract the key for each element.
Returns
The value with the maximum key in the sequence.
Exceptions
source
is null
.
No key extracted from source
implements the IComparable or IComparable<T> interface.
Applies to
MaxBy<TSource,TKey>(IQueryable<TSource>, Expression<Func<TSource,TKey>>, IComparer<TSource>)
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
Returns the maximum value in a generic IQueryable<T> according to a specified key selector function.
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static TSource MaxBy(System::Linq::IQueryable<TSource> ^ source, System::Linq::Expressions::Expression<Func<TSource, TKey> ^> ^ keySelector, System::Collections::Generic::IComparer<TSource> ^ comparer);
public static TSource? MaxBy<TSource,TKey> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TKey>> keySelector, System.Collections.Generic.IComparer<TSource>? comparer);
static member MaxBy : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Key>> * System.Collections.Generic.IComparer<'Source> -> 'Source
<Extension()>
Public Function MaxBy(Of TSource, TKey) (source As IQueryable(Of TSource), keySelector As Expression(Of Func(Of TSource, TKey)), comparer As IComparer(Of TSource)) As TSource
Type Parameters
- TSource
The type of the elements of source
.
- TKey
The type of key to compare elements by.
Parameters
- source
- IQueryable<TSource>
A sequence of values to determine the maximum value of.
- keySelector
- Expression<Func<TSource,TKey>>
A function to extract the key for each element.
- comparer
- IComparer<TSource>
The IComparer<T> to compare keys.
Returns
The value with the maximum key in the sequence.
Exceptions
source
is null
.
No key extracted from source
implements the IComparable or IComparable<T> interface.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기