private static T Reduce(IEnumerable <T> source, int sign) { Func <Pair <bool, T>, T, Pair <bool, T> > intermediateReduce = AggregationMinMaxHelpers <T> .MakeIntermediateReduceFunction(sign); Func <Pair <bool, T>, Pair <bool, T>, Pair <bool, T> > finalReduce = AggregationMinMaxHelpers <T> .MakeFinalReduceFunction(sign); Func <Pair <bool, T>, T> resultSelector = AggregationMinMaxHelpers <T> .MakeResultSelectorFunction(); AssociativeAggregationOperator <T, Pair <bool, T>, T> @operator = new AssociativeAggregationOperator <T, Pair <bool, T>, T>(source, new Pair <bool, T>(false, default(T)), null, true, intermediateReduce, finalReduce, resultSelector, default(T) != null, QueryAggregationOptions.AssociativeCommutative); return(@operator.Aggregate()); }
internal static T ReduceMin(IEnumerable <T> source) { return(AggregationMinMaxHelpers <T> .Reduce(source, -1)); }