ParallelHelperSortTKey, TValue(ArraySectionTKey, ArraySectionTValue, IComparerTKey) Method
Sorts the elements in a pair of
ArraySectionT instances synchronously (one contains the keys, the other contains the corresponding values), potentially using multiple threads.
Namespace: KGySoft.ThreadingAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.5.0
public static void Sort<TKey, TValue>(
ArraySection<TKey> keys,
ArraySection<TValue> values,
IComparer<TKey>? comparer = null
)
Public Shared Sub Sort(Of TKey, TValue) (
keys As ArraySection(Of TKey),
values As ArraySection(Of TValue),
Optional comparer As IComparer(Of TKey) = Nothing
)
public:
generic<typename TKey, typename TValue>
static void Sort(
ArraySection<TKey> keys,
ArraySection<TValue> values,
IComparer<TKey>^ comparer = nullptr
)
static member Sort :
keys : ArraySection<'TKey> *
values : ArraySection<'TValue> *
?comparer : IComparer<'TKey>
(* Defaults:
let _comparer = defaultArg comparer null
*)
-> unit
- keys ArraySectionTKey
- The ArraySectionT that contains the keys to sort.
- values ArraySectionTValue
- The ArraySectionT that contains the values that correspond to the keys in the keys collection.
If the IsNull property of values is , then only the keys are sorted.
- comparer IComparerTKey (Optional)
- The IComparerT implementation to use when comparing elements, or to use a default comparer. This parameter is optional.
Default value: .
- TKey
- The type of the elements in the keys collection.
- TValue
- The type of the elements in the values collection.
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.