A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.minby below:

Enumerable.MinBy Method (System.Linq) | Microsoft Learn

Enumerable.MinBy Method Definition Overloads MinBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)
Source:
Min.cs
Source:
Min.cs
Source:
Min.cs
Source:
Min.cs

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
TSource

The type of the elements of source.

TKey

The type of key to compare elements by.

Parameters
source
IEnumerable<TSource>

A sequence of values to determine the minimum value of.

keySelector
Func<TSource,TKey>

A function to extract the key for each element.

Returns

TSource

The value with the minimum key in the sequence.

Exceptions

TSource is a primitive type and the source sequence is empty.

Remarks

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.

MinBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)
Source:
Min.cs
Source:
Min.cs
Source:
Min.cs
Source:
Min.cs

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
TSource

The type of the elements of source.

TKey

The type of key to compare elements by.

Parameters
source
IEnumerable<TSource>

A sequence of values to determine the minimum value of.

keySelector
Func<TSource,TKey>

A function to extract the key for each element.

Returns

TSource

The value with the minimum key in the sequence.

Exceptions

TSource is a primitive type and the source sequence is empty.

Remarks

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 article

Was 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