using System;
using System.Linq;
public class Test
{
public static void Main()
{
Func<double[],double>[] array = new Func<double[],double>[] {MeanAbsoluteValue.Calculate};
double[] args = new[] {1.2, -3.4, 5.6};
double res = array[0](args);
Console.WriteLine(res);
}
}
public static class MeanAbsoluteValue{
public static double Calculate(double[] data){
return data.Sum(s => Math.Abs(s)) / data.Length;
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKCnB1YmxpYyBjbGFzcyBUZXN0CnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKCXsKCQlGdW5jPGRvdWJsZVtdLGRvdWJsZT5bXSBhcnJheSA9IG5ldyBGdW5jPGRvdWJsZVtdLGRvdWJsZT5bXSB7TWVhbkFic29sdXRlVmFsdWUuQ2FsY3VsYXRlfTsKICAgICAgICBkb3VibGVbXSBhcmdzID0gbmV3W10gezEuMiwgLTMuNCwgNS42fTsKICAgICAgICBkb3VibGUgcmVzID0gYXJyYXlbMF0oYXJncyk7CiAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUocmVzKTsKCX0KfQoKcHVibGljIHN0YXRpYyBjbGFzcyBNZWFuQWJzb2x1dGVWYWx1ZXsKICAgIHB1YmxpYyBzdGF0aWMgZG91YmxlIENhbGN1bGF0ZShkb3VibGVbXSBkYXRhKXsKICAgICAgICByZXR1cm4gZGF0YS5TdW0ocyA9PiBNYXRoLkFicyhzKSkgLyBkYXRhLkxlbmd0aDsKICAgIH0KfQ==