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

时间:2017-03-03 19:39:33   收藏:0   阅读:2565

原因

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!