Wintellect.PowerCollections Namespace
Algorithms Class
Algorithms Methods
GhostDoc Pro Sample Help File

Algorithms..::..IndexOfMaximum<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Finds the index of the maximum value in a list.

Namespace:  Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax


public static int IndexOfMaximum<T>(
	IList<T> list
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
Public Shared Function IndexOfMaximum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
	list As IList(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ IndexOfMaximum(
	IList<T>^ list
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList<(Of <(<'T>)>)>
The list to search.

Return Value

The index of the largest item in the list. If the maximum value appears multiple times, the index of the first appearance is used. If the list is empty, -1 is returned.

Exceptions


ExceptionCondition
ArgumentNullExceptionlist is null.

Remarks


Values in the list are compared by using the IComparable<T> interfaces implementation on the type T.