ParallelHelperSortT(ArraySectionT, IComparerT) Method

Sorts the elements of the specified ArraySectionT synchronously, potentially using multiple threads.

Definition

Namespace: KGySoft.Threading
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.5.0
C#
public static void Sort<T>(
	ArraySection<T> array,
	IComparer<T>? comparer = null
)

Parameters

array  ArraySectionT
The ArraySectionT instance to sort.
comparer  IComparerT  (Optional)
The IComparerT implementation to use when comparing elements, or to use a default comparer. This parameter is optional.
Default value: .

Type Parameters

T
The type of the elements in the ArraySectionT.

Remarks

  Note

This method adjusts the degree of parallelization automatically, blocks the caller, and does not support cancellation. Use the overloads with a ParallelConfig parameter to adjust parallelization and to set up cancellation; or the BeginSort/SortAsync (in .NET Framework 4.0 and above) methods to perform the sorting asynchronously.

Exceptions

ArgumentExceptionThe comparer returned inconsistent results.
InvalidOperationExceptioncomparer is , and an element does not implement the IComparableT interface.

See Also