/// <summary> /// Takes a collection of values from a set of rows and aggregates them /// </summary> /// <param name="values">The collection of values</param> private double Aggregate(EnumerableRowCollection <double> values) { // If there are no values, default to 0 if (values.Count() > 0) { switch (view.Expression.Text) { case "Sum": return(values.Sum()); case "Average": return(values.Average()); case "Max": return(values.Max()); case "Min": return(values.Min()); default: return(0); } } else { return(0); } }