public static BigInteger?Sum(this ISequence <BigInteger?> source) { return(source.Aggregate <BigInteger?, BigInteger?>( 0, (acc, i) => i == null ? acc : acc + i)); }
private object EvaluateInternal <T, TAccumulate>(ISequence <T> source, TAccumulate seed, Delegate subGraphDelegate, CancellationToken cancel) { var selector = (Func <T, TAccumulate, CancellationToken, Task <TAccumulate> >)subGraphDelegate; return(source.Aggregate <T, TAccumulate>(seed, (a, o) => selector(o, a, cancel).Result).LastAsync(cancel).Result); }
public static ISequence <decimal> Avg(this ISequence <decimal> source) { return(source.Aggregate(new _Avg <decimal>(), (a, v) => { a.Sum += v; a.Count++; return a; }).Select(x => x.Sum / x.Count)); }
public static BigInteger Sum(this ISequence <BigInteger> source) { return(source.Aggregate <BigInteger, BigInteger>( 0, (acc, i) => acc + i)); }
public static ISequence <double> Sum(this ISequence <double> source) { return(source.Aggregate(.0, (a, b) => a + b)); }
public static ISequence <decimal> Sum(this ISequence <decimal> source) { return(source.Aggregate(0M, (a, b) => a + b)); }
public static ISequence <long> Sum(this ISequence <long> source) { return(source.Aggregate(0L, (a, b) => a + b)); }
public static ISequence <float> Sum(this ISequence <float> source) { return(source.Aggregate(.0f, (a, b) => a + b)); }
public static ISequence <int> Sum(this ISequence <int> source) { return(source.Aggregate(0, (a, b) => a + b)); }
public static ISequence <decimal> Max(this ISequence <decimal> source) { return(source.Aggregate(Math.Max)); }
public static ISequence <float> Max(this ISequence <float> source) { return(source.Aggregate(Math.Max)); }
public static ISequence <T> Max <T>(this ISequence <T> source, IComparer <T> comparer = null) { comparer = comparer ?? Comparer <T> .Default; return(source.Aggregate((a, b) => comparer.Compare(a, b) > 0 ? a : b)); }
public static ISequence <double> Min(this ISequence <double> source) { return(source.Aggregate(Math.Min)); }