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!!
Naimish MakwanaPosted Feb 28, 2023, 9:31 AM
Hello Chris,
Use below code.
Thanks
Naimish Makwana