1
Answer

List (multidimentional) : How to get the sum of the 3rd column ?

chris combe

chris combe

1y
672
1
var lst = new List<(string country, string population, int number)> { };

lst.Add(("Germany", "83 Millionen", 16));
lst.Add(("USA", "328 Millionen", 40));
lst.Add(("Spain", "46 Millionen", 5));

Hi,

How can I use "lst.Sum" to get the sum of the 3rd column (16 + 40 + 5) ? (What is the syntax) ?

int sum= lst.Sum( ?

Thanks!!

 

Answers (1)