public static returnType SumAll <returnType>(Array arr, double nanval) { double r, i; Internal.VERIFY(AFAlgorithm.af_sum_nan_all(out r, out i, arr._ptr, nanval)); if (typeof(returnType) == typeof(Complex)) { return((returnType)Convert.ChangeType(new Complex(r, i), typeof(returnType))); } else { return((returnType)Convert.ChangeType(r, typeof(returnType))); } }