-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Collections_EnumerableExtensions_MaxBy__2_1
andrewvk edited this page Jul 1, 2016
·
5 revisions
EnumerableExtensions.MaxBy(TSource, TValue) Method (IEnumerable(TSource), Func(TSource, TValue), IComparer(TValue))
Invokes a selector on each element of a source and returns the item with maximum value.
Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 1.1.0.0 (1.1.0.0)
C#
public static TSource MaxBy<TSource, TValue>(
this IEnumerable<TSource> source,
Func<TSource, TValue> selector,
IComparer<TValue> comparer
)
VB
<ExtensionAttribute>
Public Shared Function MaxBy(Of TSource, TValue) (
source As IEnumerable(Of TSource),
selector As Func(Of TSource, TValue),
comparer As IComparer(Of TValue)
) As TSource
F#
[<ExtensionAttribute>]
static member MaxBy :
source : IEnumerable<'TSource> *
selector : Func<'TSource, 'TValue> *
comparer : IComparer<'TValue> -> 'TSource
- source
- Type: System.Collections.Generic.IEnumerable(TSource)
A sequence of values to determine the maximum value of. - selector
- Type: System.Func(TSource, TValue)
A transform function to apply to each element. - comparer
- Type: System.Collections.Generic.IComparer(TValue)
The IComparer(T) to compare values.
- TSource
- The type of the elements of source.
- TValue
- Type of the value
Type: TSource
The item with maximum value in the sequence.
In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(TSource). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
EnumerableExtensions Class
MaxBy Overload
CodeJam.Collections Namespace