I have two Lists (call them foo and bar) and I want to minimise the number of LINQ queries (okay, I know they have a minimal overhead, but still, two queries takes twice the time and LINQ with iOS development can be problematic). The query will be exactly the same, but I want to add the results to the two lists.
My current code looks like this
List<foo> foos = new List<foos>();
List<bar> bars = new List<bars>();
var agg = (from fa in mainList
from pa in fa.subList
from cg in pa.subSubList
let cr = pa.anotherSubList
where cg.DatePerformed.Year == DateTime.Now.Year - 1 && cr.Count != 0
select foos.Add(fa)
select bars.Add(pa));
The compiler is complaining at the second select.
Is there a way to do what I want to do in LINQ or am I going to need to use two loops?