Gets sum of values from list of integer numbers using LINQ

Amatya
Posted by Amatya under C# category on | Points: 40 | Views : 178
Gets sum of values from list of integer numbers using LINQ
var dnfnum = new List<int> { 10, 20, 30, 40, 50 };
int dnfsum = (from x in dnfnum select x).Sum(); // sum: 150


Thanks
Amatya

Comments or Responses

Login to post response