public void SortSubsets() { Subsets.Sort(delegate(Subset A, Subset B) { Counter++; if (A.TotalValue == B.TotalValue) { if (A.TotalArea == B.TotalArea) { return(0); } if (A.TotalArea > B.TotalArea) { return(1); } return(-1); } if (A.TotalValue > B.TotalValue) { return(-1); } return(1); }); }