calculate standard deviation in webmatrix

Feb 2 2015 1:54 AM
whats the easiest way to calculate the standard deviation of a query column webmatrix? any predefined method, etc?
if there isn't any easy way.. how can i utilize this code?

public static double StandardDeviation(List<double> valueList)
{ double M = 0.0;
 double S = 0.0;
 int k = 1;
 foreach (double value in valueList)
{ double tmpM = M;
 M += (value - tmpM) / k;
 S += (value - tmpM) * (value - M);
 k++;
 }
 return Math.Sqrt(S / (k-2));
 }