C# program to add the numbers using Aggregate method with function

Amatya
Posted by Amatya under C# category on | Points: 40 | Views : 375
C# program to add the numbers using Aggregate method with function

var dnfnum = new List<int> { 10, 20, 30, 40, 50 };
int dnfSum = dnfnum.Aggregate(func: dnfAdd);


private static int dnfAdd(int n1, int n2) { return n1 + n2; }



Result
dnfSum 150

Comments or Responses

Login to post response