Aggregate operator in Linq.

Gopesh9
Posted by Gopesh9 under LINQ category on | Points: 40 | Views : 1232
Here is the simple example which shows that how you can use the aggregate operator in Linq.

double[] values = { 3.7, 5.8, 2.1, 1, 7.2 }; 
double result = values.Aggregate((present, next) => present * next);
Console.WriteLine("Product of all numbers is: " + result);

Output
Product of all numbers is: 324.4752

Comments or Responses

Login to post response