Enumerable.MaxBy メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オーバーロード
MaxBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>) |
指定したキー セレクター関数とキー比較子に従って、ジェネリック シーケンスの最大値を返します。 |
MaxBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>) |
指定したキー セレクター関数に従って、ジェネリック シーケンスの最大値を返します。 |
MaxBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>, IComparer<TKey>)
指定したキー セレクター関数とキー比較子に従って、ジェネリック シーケンスの最大値を返します。
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static TSource MaxBy(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector, System::Collections::Generic::IComparer<TKey> ^ comparer);
public static TSource? MaxBy<TSource,TKey> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IComparer<TKey>? comparer);
static member MaxBy : seq<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IComparer<'Key> -> 'Source
<Extension()>
Public Function MaxBy(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
シーケンス内の最大キーを持つ値。
例外
source
が null
です。
またはIComparable<T>インターフェイスを実装するIComparableキーはsource
抽出されません。
注釈
参照型で、ソース シーケンスが空の場合、または値のみが含まれている場合 TKey
、このメソッドは null
返します null
。
適用対象
MaxBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>)
指定したキー セレクター関数に従って、ジェネリック シーケンスの最大値を返します。
public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
static TSource MaxBy(System::Collections::Generic::IEnumerable<TSource> ^ source, Func<TSource, TKey> ^ keySelector);
public static TSource? MaxBy<TSource,TKey> (this System.Collections.Generic.IEnumerable<TSource> source, Func<TSource,TKey> keySelector);
static member MaxBy : seq<'Source> * Func<'Source, 'Key> -> 'Source
<Extension()>
Public Function MaxBy(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
シーケンス内の最大キーを持つ値。
例外
source
が null
です。
またはIComparable<T>インターフェイスを実装するIComparableキーはsource
抽出されません。
注釈
参照型で、ソース シーケンスが空の場合、または値のみが含まれている場合 TKey
、このメソッドは null
返します null
。