Click or drag to resize

EnumerableExtensionsIndicesOfMinMaxT Method

Return the index of the element with the minimum value in an enumerable. If multiple elements with the same minimal value exist, the index of the first element in the sequence is returned.

Namespace: Altaxo.Collections
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3572.0 (4.8.3572.0)
Syntax
C#
public static (int IndexOfMin, int IndexOfMax) IndicesOfMinMax<T>(
	this IEnumerable<T> elements,
	Func<T, double> transformer
)

Parameters

elements  IEnumerableT
The input elements.
transformer  FuncT, Double
The function that transforms the elements to a numerical value.

Type Parameters

T
The element type of the sequence.

Return Value

ValueTupleInt32, Int32
A tuple with the index of the minimal and maximal transformed values. Returns (-1, -1) if the enumeration is empty or transforms to only non-valid numbers (NaN).

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