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)); }
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)); }
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)); }