public void SetExitToLocation(int direction, int destinationLocationId) { // If the direction exceeds the bounds of the exits array, throw an exception if (direction >= _numberOfDirections || direction < 0) throw new ArgumentOutOfRangeException("direction", "Value exceeds the limit of the array"); else _exits[direction] = destinationLocationId; }