as the same as here: How to do a Sum using Dynamic LINQ I want to do a All() with a dynamic string...
My code:
allDataValid = consumptionModelListOld.All(x => x.F11ValueValid);
I want to write:
allDataValid = consumptionModelListOld.All("F11ValueValid");
How to do this?
There is no All
"operator", and it would be quite difficult to create it... but you could:
allDataValid = !consumptionModelListOld.Where("!F11ValueValid").Any();
Note the use of !
(twice, to negate the F11ValueValid
and to negate the result of Any()
).