示例#1
0
 public static T Sum <T>(
     this IExpressionEvaluator <T> evaluator,
     IEnumerable <T> values
     ) where T : struct, IComparable <T>, IEquatable <T> =>
 values.Aggregate(evaluator.GetValue(0), (carry, current) => evaluator.Add(carry, current));
示例#2
0
 public static T Product <T>(
     this IExpressionEvaluator <T> evaluator,
     IEnumerable <T> values
     ) where T : struct, IComparable <T>, IEquatable <T> =>
 values.Aggregate(evaluator.GetValue(1), (carry, current) => evaluator.Multiply(carry, current));