var studentQuery2 = from student in students group student by student.Last[0] into g orderby g.Key select g;
采用studuents.GroupBy能实现into吗?
必须可以。扩展方法比这个提供更多的功能。
能提供个示例吗?
另外请教下,var wordGroups1 =
from w in words
group w by w[0] into fruitGroup
where fruitGroup.Count() >= 2
select new { FirstLetter = fruitGroup.Key, Words = fruitGroup.Count() };
用.select如何实现新的对象?
@happydaily:
var g=db.Students.GroupBy(x => x.col).Select(x => x);
第二个:
var wordGroups1=db.words.GroupBy(x => x.col).Where(x => x.Count() > 2).Select(x => new { x.Key, V = x.Count() });
推荐2个测试L2S的工具:LinqPad,SqlProfiler(SQL管理器自带-性能工具)。