I have the following class:
public class Data {
public Decimal DataValueA { get; set; }
public Decimal DataValueB { get; set; }
public Decimal DataValueC { get; set; }
public Decimal DataValueD { get; set; }
} // Data
And I have a List<Data>
. I need to create a new Data
object:
Data total = new Data();
Where the DataValueA
is the sum of all DataValueA
s in Data
items of List<Data>
.
The same for DataValueB
, DataValueC
, etc.
I was trying to do this with Linq but now sure how.