Linq Query Calculation

  • Thread starter Thread starter kavithma
  • Start date Start date
K

kavithma

Guest
I have below data inside my object

var summary = new List<OrderSummary>();

summary.Add(new OrderSummary(){Name = "John", Expected=10, Actual = 10});

summary.Add(new OrderSummary(){Name = "John", Expected=20, Actual = 40});

summary.Add(new OrderSummary(){Name = "Peter", Expected=3, Actual = 10});

summary.Add(new OrderSummary(){Name = "Peter", Expected=10, Actual = 4});


now i wanted to create a new object (CalculationSummary) based on the above object values with below properties on it with below values

Name , TotalExpected , TotalActual

I want to populate my new object with group by Name and need to calculate total of expected and actual values


can we write a Linq Query to get this figures ?

thanks

Continue reading...
 
Back
Top