Linq query To Calculate values inside my object

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

kavithma

Guest
Hi ,

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});


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

var name = "John";

var totalExpected = 30;

var actualExpected = 50 ;

var performance = 1.66 // calculation (50/30)

can we write a linqquery to get this figures in a single line ?

thanks

Continue reading...
 
Back
Top