我需要帮助来转换Linq查询。我已尝试使用在线转换工具,但没有运气...... 查询是这样的:
var orderedData =(from d in collezione
group d by d.Gruppo into g
orderby g.Key
from d in g
select new[] {d}.Union(g.Where(c => c.Owner == d.Comp)) into withChildren
from wc in withChildren
orderby wc.Pos
select wc).Distinct();
答案 0 :(得分:2)
我不确定这是否是您所需要的(由于您的问题未完成,因此随机拍摄):
Dim orderedData = From d In collezione
Order By d.Gruppo
Group d By d.Gruppo Into g = Group
From d In g
Select New With {
.withChildren = {d}.
Union(g.Where(Function(c) c.Owner = d.Comp))
}
Dim result = (From od In orderedData
From wc In od.withChildren
Order By wc.Pos
Select wc).Distinct