Is there a way to write a single LINQ expression to get the same result of the following code?
var validations = new Func<conversion, bool>[] {
c => c.affiliate.affiliate_id > 0,
c => c.campaign_id > 0
};
var invalidConversions = from c in extractedConversions
where validations.Any(valid => !valid(c))
select c;
var validConversions = from c in extractedConversions
where validations.All(valid => valid(c))
select c;
Well you could use something like:
Then:
You could use
GroupByas well, butToLookupmaterializes the results immediately and gives you a handy way of accessing them, which I suspect is what you want here.