In C#:
List<List<Point>> SectionList = new List<List<Point>>();
SectionList contains lists of points where each sub list varies in how many points it contains.
What I’m trying to figure out is how to sort SectionList by the Count of sub lists in descending order.
So if SectionList had 3 lists of points, after sorting, SectionList[0] would contain the highest Count value of all 3 lists.
Thanks,
Mythics
This should work:
The
(a,b) => a.Count - b.Countis a comparison delegate. TheSortmethod calls it with pairs of lists to compare, and the delegate that returns a negative number ifais shorter thanb, a positive number ifais longer thanb, and zero when the two lists are of the same length.