for example, the following composite query + method looks not good enough. I am seeking for better approach.
foreach (var x in A)
{
foreach (var y in B)
{
if (getLazyList(x, y).Any(z => z == y))
{
blacklist.Add(x);
break;
}
}
}
Now compared to this one provided by: @Bob Vale
var q = from x in A
from y in B
where getLazyList(x,y).Contains(y)
select x;
blacklist.AddRange(q);
would 2nd method do the unnecessary loops? in 1st example i use .any() and break to escape the inner loop, how would linq handle this in 2nd case?