C# 非泛型“***”不能与类型实参一起使用的错误

时间:2017-03-03 19:39:31   收藏:0   阅读:1163

原因

    缺少包含:using System.Collections.Generic;


代码

    public class Cost

    {

        public double cost;

        public int id;

    }


    public class CostComparer : IComparer<Cost>

    {

        public int Compare(Cost x, Cost y)

        {

            if (x.cost - y.cost < 1e-10)

            {

                return -1;

            }

            else

            {

                return 1;

            }

        }

    }


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!