I am trying to use an IComparer to sort a list of Points. Here is the IComparer class:
public class CoordinatesBasedComparer : IComparer
{
p
public class CoordinatesBasedComparer : IComparer, IComparer
{
public int Compare(Point a, Point b)
{
if ((a.x == b.x) && (a.y == b.y))
return 0;
if ((a.x < b.x) || ((a.x == b.x) && (a.y < b.y)))
return -1;
return 1;
}
int IComparer.Compare(Object q, Object r)
{
return Compare((Point)q, (Point)r);
}
}