c# - how to avoid the member assignment in LINQ orderby/groupby -


i have query return count based on condition

 var query = (from in this.db.servers      (a.date >= fromdp.selecteddate.value && a.date <= todp.selecteddate.value)     group entityfunctions.truncatetime(a.date) p  select new { b = p.count()}).orderby( x=> x.b);                               

edit

when binded listbox's itemsource this,

 dummy.itemssource = query.tolist(); 

xaml

  <listbox x:name="dummy"  itemssource="{binding}" /> 

which displays output this

enter image description here

how avoid member assignment "b" here , display integer values? possible

just guess should avoid using anonymous type in here selecting count directly:

var query = (from in this.db.servers                  (a.date >= fromdp.selecteddate.value                             && a.date <= todp.selecteddate.value)                 group entityfunctions.truncatetime(a.date) p              select p.count()).orderby(x => x);   

Comments