Just as the name suggests this is just another sorting library for .Net Core.
Description | Done | Comment | Description | Done | Comment |
---|---|---|---|---|---|
Bubble Sort | ✔ | Cocktail Sort | ✔ | ||
Insertion Sort | ✔ | Shell Sort | ✔ | ||
Merge Sort | ✔ | Recursive | Heap Sort | ✔ | |
Quick Sort | ✔ | Recursive | Gnome Sort | ✔ | |
Selection Sort | ✔ | Pancake Sort | ✔ |
int[] UnsortedArray = new[] {1, 5, 6, 2, 4, 3};
SortDotNet<int>.Sort(UnsortedArray, SortType.Bubble, SortOrder.Decending);
Implement IComparable Interface to your model class
public class Product:IComparable<Product>
{
public string Id;
public string Name;
public float Cost;
public float Price;
public int CompareTo(Product other)
{
if (Cost > other.Cost) return 1;
if (Cost < other.Cost) return -1;
return 0;
}
}
Use it just like you would for Base Types
SortDotNet<Product>.Sort(UnsortedArray, SortType.Bubble, SortOrder.Decending);
Implementation Credits : https://rosettacode.org/wiki/Category:Sorting_Algorithms
Sonarcube wip