I need to write function that will accept array of decimals and it will find the median.
Is there a function in the .net Math library?
CenterSpace's NMath library provides a function:
double[] values = new double[arraySize];
double median = NMathFunctions.Median(values);
Optionally you can opt to use NaNMedian (if your array may contain null values) but you will need to convert the array to a vector:
double median = NMathFunctions.NaNMedian(new DoubleVector(values));
CenterSpace's NMath Library isn't free, but many universities have licenses