コード例 #1
0
ファイル: Car.cs プロジェクト: tolco97/DNP2-Assignments
        public int CompareToByHorsePower(Car other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }

            return(other is null
                ? 1
                : HorsePower.CompareTo(other.HorsePower));
        }
コード例 #2
0
ファイル: Car.cs プロジェクト: saralopez7/DNP2Assignment1
        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);
        }