I am developing software that receives real-time data and extracts from it a number of functions that depend on user input. Each available function consists of one method that takes an array of doubles and returns the desired function, such as this for MeanAbsoluteValue:
public static class MeanAbsoluteValue{
public static double Calculate(double[] data){
return data.Sum(s => Math.Abs(s)) / data.Length;
}
}
Since each function has only one Calculate method, I thought about trying to rewrite them so that they could be assembled and selected from this collection.
I tried to write an interface to use them, but since they are static, this was not allowed.
Is there any way to do this? And if so, could you point me in the right direction?
source
share