Is there a more succinct way to write this:
var targets = collection
.Where(x => x is ITarget)
.Cast<ITarget>();
It seems like there should be a way to combine the calls the Where
and Cast
into a single operation. However, perusing Enumerable
turns up no likely candidates.
Does such a LINQ operation exist or is this the only way to do it?