Aggregate - Simple

Query
public void Linq92()
{
double[] doubles = { 1.7, 2.3, 1.9, 4.1, 2.9 };

double product = doubles.Aggregate((runningProduct, nextFactor) => runningProduct * nextFactor);

Console.WriteLine("Total product of all numbers: {0}", product);
}
Lambda Expression
public void Linq92()
{
double[] doubles = { 1.7, 2.3, 1.9, 4.1, 2.9 };

double product = doubles.Aggregate((runningProduct, nextFactor) => runningProduct * nextFactor);

Console.WriteLine("Total product of all numbers: {0}", product);
}
Output
Total product of all numbers: 88.33081
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +