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.3179.0 (4.8.3179.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

[Missing <typeparam name="T"/> documentation for "M:Altaxo.Collections.EnumerableExtensions.IndicesOfMinMax``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Double})"]

Return Value

ValueTupleInt32, Int32
The index of the last element with the minimum value. Returns the indeces of the minimal value and the maximal value, and -1 if the enumeration is empty or the elements are transformed to only nonvalid 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