Enumerable.MinBy メソッド

定義

オーバーロード

MinBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

指定したキー セレクター関数に従って、ジェネリック シーケンスの最小値を返します。

MinBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)

指定したキー セレクター関数とキー比較子に従って、ジェネリック シーケンスの最小値を返します。

MinBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)

ソース:
Min.cs
ソース:
Min.cs
ソース:
Min.cs

指定したキー セレクター関数に従って、ジェネリック シーケンスの最小値を返します。

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

型パラメーター

TSource

source の要素の型。

TKey

要素を比較するキーの型。

パラメーター

source
IEnumerable<TSource>

最小値を確認する対象となる値のシーケンス。

keySelector
Func<TSource,TKey>

各要素のキーを抽出する関数。

戻り値

TSource

シーケンス内の最小キーを持つ値。

例外

sourcenull です。

からsource抽出されたキーは、 または IComparable<T> インターフェイスをIComparable実装しません。

TSource はプリミティブ型で、ソース シーケンスは空です。

注釈

ソース シーケンスが空で TSource 、null 許容型の場合、このメソッドは を返します null。 ソース シーケンスが空で TSource 、プリミティブ型などの null 非許容構造体である場合は、 InvalidOperationException がスローされます。

ソース シーケンスに である値のみが含まれている場合。null

適用対象

MinBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)

ソース:
Min.cs
ソース:
Min.cs
ソース:
Min.cs

指定したキー セレクター関数とキー比較子に従って、ジェネリック シーケンスの最小値を返します。

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

型パラメーター

TSource

source の要素の型。

TKey

要素を比較するキーの型。

パラメーター

source
IEnumerable<TSource>

最小値を確認する対象となる値のシーケンス。

keySelector
Func<TSource,TKey>

各要素のキーを抽出する関数。

comparer
IComparer<TKey>

IComparer<T>キーを比較する 。

戻り値

TSource

シーケンス内の最小キーを持つ値。

例外

sourcenull です。

からsource抽出されたキーは、 または IComparable<T> インターフェイスをIComparable実装しません。

TSource はプリミティブ型で、ソース シーケンスは空です。

注釈

ソース シーケンスが空で TSource 、null 許容型の場合、このメソッドは を返します null。 ソース シーケンスが空で TSource 、プリミティブ型などの null 非許容構造体である場合は、 InvalidOperationException がスローされます。

ソース シーケンスに である値のみが含まれている場合。null

適用対象