EnumerableExtensionsMaxOrDefaultT, M(IEnumerableT, FuncT, M, M) Method |
Evaluates the maximum of a enumeration of elements, or returns a default value if the series is empty.
Namespace: Altaxo.CollectionsAssembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax public static M MaxOrDefault<T, M>(
this IEnumerable<T> seq,
Func<T, M> conversion,
M defaultValue
)
where M : Object, IComparable<M>
Parameters
- seq IEnumerableT
- The enumeration of elements.
- conversion FuncT, M
- Conversion function which converts the type T of the original sequence into a type M which is used to determine the maximum value.
- defaultValue M
- The default value that is returned if the enumeration is empty.
Type Parameters
- T
- Type of element
- M
- Type of comparison value that results from the element.
Return Value
MThe maximum of of all comparison values of the elements, or the
defaultValue if the series is empty.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also