Returns the minimum value in a generic sequence according to a specified key selector function.
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static TSource MinBy(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector);
public static TSource? MinBy<TSource,TKey>(this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector);
static member MinBy : seq<'Source> * Func<'Source, 'Key> -> 'Source
<Extension()>
Public Function MinBy(Of TSource, TKey) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey)) As TSource
Type Parameters
The type of the elements of source
.
The type of key to compare elements by.
ParametersA sequence of values to determine the minimum value of.
A function to extract the key for each element.
ReturnsTSource
The value with the minimum key in the sequence.
ExceptionsTSource
is a primitive type and the source sequence is empty.
If the source sequence is empty, two possible outcomes are possible depending on the source type. If TSource
is a nullable type, this method returns null
. If TSource
is a non-nullable struct, such as a primitive type, an InvalidOperationException is thrown.
If the source sequence contains only values that are null
, this method returns null
.
Returns the minimum value in a generic sequence according to a specified key selector function and key comparer.
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static TSource MinBy(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector, System::Collections::Generic::IComparer<TKey> ^ comparer);
public static TSource? MinBy<TSource,TKey>(this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IComparer<TKey>? comparer);
static member MinBy : seq<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IComparer<'Key> -> 'Source
<Extension()>
Public Function MinBy(Of TSource, TKey) (source As IEnumerable(Of TSource), keySelector As Func(Of TSource, TKey), comparer As IComparer(Of TKey)) As TSource
Type Parameters
The type of the elements of source
.
The type of key to compare elements by.
ParametersA sequence of values to determine the minimum value of.
A function to extract the key for each element.
ReturnsTSource
The value with the minimum key in the sequence.
ExceptionsTSource
is a primitive type and the source sequence is empty.
If the source sequence is empty, two possible outcomes are possible depending on the source type. If TSource
is a nullable type, this method returns null
. If TSource
is a non-nullable struct, such as a primitive type, an InvalidOperationException is thrown.
If the source sequence contains only values that are null
, this method returns null
.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4