fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. Func<double[],double>[] array = new Func<double[],double>[] {MeanAbsoluteValue.Calculate};
  9. double[] args = new[] {1.2, -3.4, 5.6};
  10. double res = array[0](args);
  11. Console.WriteLine(res);
  12. }
  13. }
  14.  
  15. public static class MeanAbsoluteValue{
  16. public static double Calculate(double[] data){
  17. return data.Sum(s => Math.Abs(s)) / data.Length;
  18. }
  19. }
Success #stdin #stdout 0.03s 33984KB
stdin
Standard input is empty
stdout
3.4