Suppose I have a list or an array of elements, and I want to summarize a subset of the elements in a list. (in my case, it will always be a sequential subset).
Here is an old fashioned way:
int sum = 0;
for(int i = startIndex; i <= stopIndex; i++)
sum += myList[i].TheValue;
return sum;
What is the best linqify way of this code?
source
share