My query is as below
var result = from cr in cumulativeresult
orderby cr.Days
select new
{
Days = cr.Days,
Com = (from cr1 in cumulativeresult
where cr1.Days < cr.Days
group cr1 by 1 into cr1grp
select
new
{
Count = cr1grp.Count() + cr.Com
}),
ComPercent = Math.Round((double.Parse((
from cr1 in cumulativeresult
where cr1.Days < cr.Days
group cr1 by 1 into cr1grp
select cr1grp.Count() + cr.Com).ToString()) / ComCount) * 100, 2)
};
But the Com and ComPercent are not coming as values. How will I be able to retrieve the value within them? My loop for retrieving them is as follows
Update
foreach (var item in result)
{
dt.Rows.Add(item.Days, item.Com, item.ComPercent);
}
I do not want to do any processing on my foreach loop, I want the value in my linq query itself.