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

Algorithms..::..Maximum<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Finds the maximum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

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

Syntax


public static T Maximum<T>(
	IEnumerable<T> collection,
	Comparison<T> comparison
)
where T : IComparable<T>
Public Shared Function Maximum(Of T As IComparable(Of T)) ( _
	collection As IEnumerable(Of T), _
	comparison As Comparison(Of T) _
) As T
public:
generic<typename T>
where T : IComparable<T>
static T Maximum(
	IEnumerable<T>^ collection, 
	Comparison<T>^ comparison
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable<(Of <(<'T>)>)>
The collection to search.
comparison
Type: Comparison<(Of <(<'T>)>)>
The comparison used to compare items in the collection.

Return Value

The largest item in the collection.

Exceptions


ExceptionCondition
InvalidOperationExceptionThe collection is empty.
ArgumentNullExceptioncollection or comparison is null.