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

原因

    缺少包含: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;

            }

        }

    }


文章来自:http://fengyuzaitu.blog.51cto.com/5218690/1902988
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3