AlgorithmsIndexOfMaximumT Method (IListT, IComparerT) |
Finds the index of the maximum value in a list. A supplied IComparer<T> is used
to compare the items in the collection.
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static int IndexOfMaximum<T>(
IList<T> list,
IComparer<T> comparer
)
public:
generic<typename T>
static int IndexOfMaximum(
IList<T>^ list,
IComparer<T>^ comparer
)
Parameters
- list
- Type: System.Collections.GenericIListT
The list to search. - comparer
- Type: System.Collections.GenericIComparerT
The comparer instance used to compare items in the collection.
Type Parameters
- T
- The type of items in the list.
Return Value
Type:
Int32The 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
See Also