Пример #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));
        }