Skip to content

01. Quick Starter Guide

Tanimul Haque Khan edited this page Aug 28, 2021 · 1 revision

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);
Clone this wiki locally