从 C# 到 VB:NET 的 Linq 查询转换

本文关键字:Linq 查询 转换 NET VB | 更新日期: 2023-09-27 18:30:49

我需要转换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();

从 C# 到 VB:NET 的 Linq 查询转换

我不确定这是否是你需要的(这是一个随机镜头,因为你的问题不完整):

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