You are right, the information is redundant. It is always possible that the List<Wall> in a Room may contain walls; the Room property refers to another room, which would be an error. Therefore, either remove it from Wall , or make sure that each Wall is checked in the Walls installer. If the Room wall is != this , you can throw an exception or change it.
So, I would change the Room class a bit:
public class Room { private List<Wall> walls; public Room(): this(new List<Wall>()) { } public Room(List<Wall> walls) { this.Walls = walls; } public List<Wall> Walls { get { return this.walls; } set { foreach (Wall wall in value) { if (wall?.Room != this) { throw new ArgumentException("Every wall room must be this Room instance", nameof(Walls)); } } this.walls = value; } } }
Since there are usually 4 walls in a room, this should not be a big problem.
source share