Total sum for an object property value in a list using a lambda function
c#, lambda, list, properties
Solution
Test data
var ls=new List<OutputRow>();
ls.Add(new OutputRow(){propertyX=4});
ls.Add(new OutputRow(){propertyX=6});
ls.Add(new OutputRow(){propertyX=5});
Lambda
var total= ls.Sum(x=>x.propertyX);
Problem
I have the following: `List<OutputRow>` which contains a number of `OutputRow` objects. I am wondering if there is a way for me to use a lambda function on the list to return the total sum of the values of a certain propertyX on each OutputRow object in the list. Example list: ``` OutputRow.propertyX = 4 OutputRow.propertyX = 6 OutputRow.propertyX = 5 ``` return 15