Example #1
0
        public int CompareToByEngineSize(Car other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }

            return(other is null
                ? 1
                : EngineSize.CompareTo(other.EngineSize));
        }
Example #2
0
        public (int, int, int, int, int) CompareCarProperties(Car other)
        {
            var comparisonTuple = (
                maxSpeedComparison : MaxSpeed.CompareTo(other.MaxSpeed),
                accelerationComparison : Acceleration.CompareTo(other.Acceleration),
                cylinderComparison : Cylinders.CompareTo(other.Cylinders),
                engineSizeComparison : EngineSize.CompareTo(other.EngineSize),
                horsePowerComparison : HorsePower.CompareTo(other.HorsePower)
                );

            return(comparisonTuple);
        }