public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return(false); } var other = (Route)obj; if (Waypoints.Length != other.Waypoints.Length || Waypoints.GetLength(0) != other.Waypoints.GetLength(0)) { return(false); } for (int santa = 0; santa < Waypoints.GetLength(0); santa++) { for (int day = 0; day < Waypoints.GetLength(1); day++) { if (!Waypoints[santa, day].SequenceEqual(other.Waypoints[santa, day])) { return(false); } } } return(true); }
public override string ToString() { string str = Environment.NewLine; for (int santa = 0; santa < Waypoints.GetLength(0); santa++) { str += $"Santa {santa}{Environment.NewLine}"; for (int day = 0; day < Waypoints.GetLength(1); day++) { str += $"Day {day}{Environment.NewLine}"; str += $"Visit | StartTime{Environment.NewLine}"; if (Waypoints[santa, day].Count > 0) { str += Waypoints[santa, day].Select(w => $"{w.Visit,6}| {w.StartTime,6}").Aggregate((a, v) => a + Environment.NewLine + v); } str += Environment.NewLine; } str += Environment.NewLine; } return(str); }