I have a double[] array holding many numbers.
I have an algorithm that selects sections from within this array that fall under certain conditions (value greater than x, at least y values, etc.)
Now I want to calculate the average value of all these values in my section.
So, say my section is from index 20 to 40. Now I have 20 values. Is there an easy way to do this in C# or do I have to loop over my array and calculate the average by hand?