【发布时间】:2010-01-18 03:41:55
【问题描述】:
LINQ-newb 无法使用分组。我正在尝试查询一个名为 doseWithHighestScore 的 IEnumerable。
我正在关注这个例子: http://msdn.microsoft.com/en-us/vcsharp/aa336747.aspx#minGrouped
这是我的代码:
var doseWithLowestVolumeForForm =
from d in dosesWithHighestScore
group d by d.formulation.form into g
select new {
Form = g.Key,
LowDose = g.Group.Min(d => d.doseAdministrableAmount)
};
使用“组”导致此错误:
“System.Linq.IGrouping”不包含“Group”的定义,并且找不到接受“System.Linq.IGrouping”类型的第一个参数的扩展方法“Group”(您是否缺少 using 指令或程序集参考?)
这是我的用法:
using System;
using System.Text;
using System.Linq;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Collections;
为什么会出现这个错误?
【问题讨论】:
标签: c# linq linq-to-objects