27
Let's say I have some code:
var items = ItemsGetter.GetAllItems().Where(x => x.SomeProperty > 20);
int sum1 = items.Sum(x => x.SomeFlag == true);
And for example I need some other sum from the items collection later in the code.
int sum2 = items.Sum(x => x.OtherFlag == false);
So my question: Is it OK to call Linq methods on IEnumerable more than once? Maybe I should call Reset() method on enumerator or make list from items using ToList method?