I have an object heirarchy:
DeathStar.Floors.Departments.Rooms
At the moment, I'm only selecting floors that contain departments that have a room containing rebel scum being intimidated or injected by a droid:
var rebelScum = deathStar.Floors.Where(
f=> f.Departments.Any(
d => d.Rooms.Any(
r => r.Occupant.Allegiance == "Rebel"
&& (r.InterrogationState == Interrogation.Intimidation
|| r.InterrogationState == Interrogation.FloatyStabbyDroid)
)
)
);
However, rebelScum
will contain empty rooms in the same department as any rebel scum being interrogated.
Can I filter inside this .Where()
to only return the occupied rooms?