IndexOf<>(source, predicate, startIndex) IndexOf<>(source, element, comparer) JoinString<>(values, separator, prefix, suffix, lastSeparator) Order<>(source, comparer) SkipLast<>(source, count, throwIfNotEnough) Split<>(splitWhat, splitWhere) Split<>(source, chunkSize) ToDictionary2<>(source, key1Selector, key2Selector, comparer1, comparer2) ToDictionary2<>(source, key1Selector, key2Selector, elementSelector, comparer1, comparer2)
Legend Class Struct Enum Interface Delegate | Constructor Method Property Event Field |
| Extension method: TResult MaxOrDefault<TSource, TResult>(this IEnumerable<TSource>, Func<TSource, TResult>, TResult)Declarationpublic static TResult MaxOrDefault<TSource, TResult>(
this IEnumerable<TSource> source,
Func<TSource, TResult> selector,
TResult default = null
) Summary
Invokes a selector on each element of a collection and returns the maximum resulting value, or a default value
if the sequence is empty. Generic type parametersTSource |
The type of the elements of source. | TResult |
The type of the value returned by selector. |
Parametersthis IEnumerable<TSource> | source |
A sequence of values to determine the maximum value of. | Func<TSource, TResult> | selector |
A transform function to apply to each element. | TResult | default |
A default value to return in case the sequence is empty. |
Returns
The maximum value in the sequence, or the specified default value if the sequence is empty. |