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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -