You can use the built-in LINQ Aggregate(...) method to do this and many other more complicated calculations i.e.
int[] n = new int[] { 1, 2, 3, 4, 4, 5, 5, 6 };
int sum = n.Aggregate((x, y) => x + y);
as the lamdba is executed, once for each element in the enumeration the values of x,y are
0,1
1,2
3,3
6,4,
10,4,
14,5,
19,5
24,6
respectively and the final result is 30
With this you can use any aggregating function you want:
For example:
int[] n = new int[] { 1, 2, 3, 4, 4, 5, 5, 6 };
int count = n.Aggregate((x, y) => x + 1);
To simplify this there are built-in functions for common aggregates like Count and Max.
Hope this helps
Alex