我正在尝试使用IComparer对点列表进行排序。这是 IComparer 类:
public class CoordinatesBasedComparer : IComparer
{
    public int Compare(Object q, Object r)
    {
        Point a = (p)q;
        Point b = (p)r;
        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;
    }
}
在客户端代码中,我正在尝试使用此类对点列表 p (类型List<Point>)进行排序:
CoordinatesBasedComparer c = new CoordinatesBasedComparer();
Points.Sort(c);
代码出错了。显然,它期望IComparer<Point>作为排序方法的参数。
我需要做什么来解决这个问题?