/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> public override int GetHashCode() { unchecked { int hashCode = CarId; hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Color != null ? Color.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Year; hashCode = (hashCode * 397) ^ RentalPrice.GetHashCode(); hashCode = (hashCode * 397) ^ CurrentlyRented.GetHashCode(); return(hashCode); } }
protected bool Equals(Car other) { return(CarId == other.CarId && string.Equals(Description, other.Description) && string.Equals(Color, other.Color) && Year == other.Year && RentalPrice == other.RentalPrice && CurrentlyRented.Equals(other.CurrentlyRented)); }