Beispiel #1
0
 public static BigInteger?Sum(this ISequence <BigInteger?> source)
 {
     return(source.Aggregate <BigInteger?, BigInteger?>(
                0,
                (acc, i) => i == null ? acc : acc + i));
 }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 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));
 }
Beispiel #4
0
 public static BigInteger Sum(this ISequence <BigInteger> source)
 {
     return(source.Aggregate <BigInteger, BigInteger>(
                0,
                (acc, i) => acc + i));
 }
Beispiel #5
0
 public static ISequence <double> Sum(this ISequence <double> source)
 {
     return(source.Aggregate(.0, (a, b) => a + b));
 }
Beispiel #6
0
 public static ISequence <decimal> Sum(this ISequence <decimal> source)
 {
     return(source.Aggregate(0M, (a, b) => a + b));
 }
Beispiel #7
0
 public static ISequence <long> Sum(this ISequence <long> source)
 {
     return(source.Aggregate(0L, (a, b) => a + b));
 }
Beispiel #8
0
 public static ISequence <float> Sum(this ISequence <float> source)
 {
     return(source.Aggregate(.0f, (a, b) => a + b));
 }
Beispiel #9
0
 public static ISequence <int> Sum(this ISequence <int> source)
 {
     return(source.Aggregate(0, (a, b) => a + b));
 }
Beispiel #10
0
 public static ISequence <decimal> Max(this ISequence <decimal> source)
 {
     return(source.Aggregate(Math.Max));
 }
Beispiel #11
0
 public static ISequence <float> Max(this ISequence <float> source)
 {
     return(source.Aggregate(Math.Max));
 }
Beispiel #12
0
 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));
 }
Beispiel #13
0
 public static ISequence <double> Min(this ISequence <double> source)
 {
     return(source.Aggregate(Math.Min));
 }