示例#1
0
        public int CompareByFuelConsumption(SportCar one, SportCar two)
        {
            if (ReferenceEquals(one, two))
            {
                return(0);
            }
            if (ReferenceEquals(one, null))
            {
                return(-1);
            }
            if (ReferenceEquals(two, null))
            {
                return(1);
            }

            return(one.FuelConsumption.CompareTo(two.FuelConsumption));
        }
示例#2
0
        public int CompareByBrandName(SportCar one, SportCar two)
        {
            if (ReferenceEquals(one, two))
            {
                return(0);
            }
            if (ReferenceEquals(one, null))
            {
                return(-1);
            }
            if (ReferenceEquals(two, null))
            {
                return(1);
            }

            return(one.BrandName.CompareTo(two.BrandName));
        }
示例#3
0
        public int CompareByEngine(SportCar one, SportCar two)
        {
            if (ReferenceEquals(one, two))
            {
                return(0);
            }
            if (ReferenceEquals(one, null))
            {
                return(-1);
            }
            if (ReferenceEquals(two, null))
            {
                return(1);
            }

            return(one.Engine.CompareTo(two.Engine));
        }