Class ArraySorting
- Namespace
- Garyon.Extensions.ArrayExtensions
- Assembly
- Garyon.dll
Contains functions about sorting arrays.
[ExcludeFromCodeCoverage]
public static class ArraySorting
- Inheritance
-
ArraySorting
- Inherited Members
Methods
SortBy<T>(T[], IComparer<T>)
Sorts the array by a custom IComparer<T>. The original instance is affected.
public static T[] SortBy<T>(this T[] array, IComparer<T> comparer)
Parameters
arrayT[]The array that will be sorted.
comparerIComparer<T>The comparer that will be used when comparing the values during sorting.
Returns
- T[]
The original array instance.
Type Parameters
TThe type of the values stored in the array.
SortBy<T>(T[], Comparison<T>)
Sorts the array by a custom Comparison<T>. The original instance is affected.
public static T[] SortBy<T>(this T[] array, Comparison<T> comparison)
Parameters
arrayT[]The array that will be sorted.
comparisonComparison<T>The comparison function that will be used when comparing the values during sorting.
Returns
- T[]
The original array instance.
Type Parameters
TThe type of the values stored in the array.
Sort<T>(T[])
Sorts the array, affecting the original array. Returns the instance of the original array.
public static T[] Sort<T>(this T[] array)
Parameters
arrayT[]The original array to sort.
Returns
- T[]
Type Parameters
TThe type of the array elements.