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

Algorithms..::..SortInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Sorts a list or array in place. A supplied IComparer<T> is used to compare the items in the list.

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

Syntax


public static void SortInPlace<T>(
	IList<T> list,
	IComparer<T> comparer
)
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 Sub SortInPlace(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), _
	comparer As IComparer(Of T) _
)
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 void SortInPlace(
	IList<T>^ list, 
	IComparer<T>^ comparer
)

Type Parameters

T

Parameters

list
Type: IList<(Of <(<'T>)>)>
The list or array to sort.
comparer
Type: IComparer<(Of <(<'T>)>)>
The comparer instance used to compare items in the collection. Only the Compare method is used.

Remarks


The Quicksort algorithms is used to sort the items. In virtually all cases, this takes time O(N log N), where N is the number of items in the list.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.