sorting a list of objects by two properties

26 Views Asked by At

So I have a list of objects which have a point 2d as a property on them. Up until now I've been using this function to sort the list by the X values going left to right

BalloonList.Sort(Function(Balloon1, Balloon2) Balloon1.Leader.AllNodes(2).Position.X.CompareTo(Balloon2.Leader.AllNodes(2).Position.X))

However, I now need a conditional sort for when two of these points have the same (Ideally within a small range) it sorts them by the Y Value from top to bottom. What's the best method to do this?

For more context, I am Ballooning an assembly in Autodesk inventor using VB.net

BalloonList.Sort(Function(Balloon1, Balloon2) Balloon1.Leader.AllNodes(2).Position.X.CompareTo(Balloon2.Leader.AllNodes(2).Position.X))
0

There are 0 best solutions below