/** * Returns the room by given condition * @returns Either the building or null if the room couldnt be found */ public Room GetRoomBy(RoomMatchDelegate match) { Room rtn = null; foreach(Room room in _rooms) { if(match(room)) { rtn = room; break; } } return rtn; }
/** * Returns all of the rooms that match the condition given in the * parameter. */ public List<Room> GetRoomsBy(RoomMatchDelegate match) { List<Room> rtnList = new List<Room>(); foreach(Room room in _rooms) { if(match(room)) { rtnList.Add(room); } } return rtnList; }