c# - How can I sort the results of a LINQ query -


i have following query. there easy way sort results in numeric order of rowkey. rowkey string. sort _rowdata , not modify query want try different sort orders , i'm looking 1 line changes , not redo query.

var _rowdata = (from qu in _que.getall(   u => u.partitionkey == partitionkey )   select new {     qu.partitionkey,     qu.rowkey,     qu.style,     qu.shorttitle,     modifiedtostring = string.format("{0:mm/dd/yyyy hh:mm}", qu.modified) }); 

i want sorting outside of linq query. reason want able let user choose sort of rowkey, modifiedtostring , shorttitle.

when use orderby extension, don't modify original query, enumerates same values:

var _rowdata = ... var _rowdatasortedbyrowkey = _rowdata.orderby( u => u.rowkey ); var _rowdatasortedbymodifiedtostring = _rowdata.orderby( u => u.modifiedtostring ); var _rowdatasortedbyshorttitle = _rowdata.orderby( u => u.shorttitle ); var _rowdatasortedbyother = _rowdata.orderby( ... ); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -