linq - c# databable how to sort this one -
this code
var result = (from row in inboundtable.asenumerable() campains.contains(row.field<string>("campaign")) group row new { date = row.field<string>("date"), slice = row.field<string>("slice") } grp select new { sl = grp.sum((r) => double.parse(r["inb.servicelevel"].tostring())) / grp.count(), date = ((datetime.parse(grp.key.date.tostring() + " " + grp.key.slice.tostring().split('-')[0])) - epoch).totalmilliseconds }).tolist();
how can sort result
according date
column? past current
for example
how can sort result according date column? past current
use orderby
var result = (from row in inboundtable.asenumerable() campains.contains(row.field<string>("campaign")) group row new { date = row.field<string>("date"), slice = row.field<string>("slice") } grp select new { sl = grp.sum((r) => double.parse(r["inb.servicelevel"].tostring())) / grp.count(), date = ((datetime.parse(grp.key.date.tostring() + " " + grp.key.slice.tostring().split('-')[0])) - epoch).totalmilliseconds }) .orderby(r=> r.date) //here .tolist();
Comments
Post a Comment