Click or drag to resize

EnumerableExtensionsIndexOfMaxT Method

Return the index of the element with the maximum 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 IndexOfMax<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.IndexOfMax``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,System.Double})"]

Return Value

Int32
The index of the last element with the minimum value. Returns -1 if the element enumeration is empty or contains only nonvalid elements (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