C# LINQ select until amount >= 0

Viewed 1771

This is example database table Name | Quantanity Book I | 1 Book II | 13 Book III | 5 etc...

And I want to select this rows until I will have 100 books usinq LINQ expression.

I was trying

.TakeWhile(x => (amount -= x.Quantanity) > 0);

But it gave me an error

"Expression tree cannot contain assignment operator"

2 Answers
Related