/// <summary> /// Returns a boolean indicating if the passed in object obj is /// Equal to this. The specified object is equal to this if both /// objects are timetables that are active at the same times of the week. /// </summary> /// <param name="other">The object to compare with the current object.</param> /// <returns>True if the specified object is equal to the current object; otherwise, false.</returns> public bool Equals(TimeTable other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(IsEqual(other)); }
private bool IsEqual(TimeTable other) { for (var i = 0; i < 24; i++) { if (Rows[i].Monday != other.Rows[i].Monday) { return(false); } if (Rows[i].Tuesday != other.Rows[i].Tuesday) { return(false); } if (Rows[i].Wednesday != other.Rows[i].Wednesday) { return(false); } if (Rows[i].Thursday != other.Rows[i].Thursday) { return(false); } if (Rows[i].Friday != other.Rows[i].Friday) { return(false); } if (Rows[i].Saturday != other.Rows[i].Saturday) { return(false); } if (Rows[i].Sunday != other.Rows[i].Sunday) { return(false); } } return(true); }