csharp sum of list
Code Example - csharp sum of list
using System.Linq;
int my_sum = my_int_list.Sum();
add all elements in a list csharp
using System.Collections.Generic;
using System.Linq;
List<int> intList = new List<int>(){1, 2, 3, 4};
int sum = intList.Aggregate((x, y) => x + y);
csharp calculate sum of list
double total = myList.Sum(item => item.Amount);
list sum csharp
int total = monValues.Sum(x => Convert.ToInt32(x));