我有一个查询返回基于条件的计数如何避免LINQ排序依据的成员分配/ GROUPBY
var query = (from a in this.db.Servers
where (a.Date >= fromDP.SelectedDate.Value && a.Date <= toDP.SelectedDate.Value)
group a by EntityFunctions.TruncateTime(a.Date) into p
select new { b = p.Count()}).OrderBy(x=> x.b);
编辑
当绑定到一个ListBox的的ItemSource这样,
dummy.ItemsSource = query.ToList();
XAML
<ListBox x:Name="dummy" ItemsSource="{Binding}" />
,其显示这样
输出如何避免构件分配“b”的和在这里只显示了整数值?是否有可能
什么显示输出?您的代码段中没有任何内容显示输出... – 2013-05-06 09:45:48
这本身并不输出任何内容。你在谈论调试视图吗? – antonijn 2013-05-06 09:45:48
对不起,我现在要编辑这个问题 – user1221765 2013-05-06 09:46:22