How is a set partitioned into valid and invalid items using LINQ?
- by Aaron Anodide
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;