2012-04-11 67 views
-6

我需要轉換Linq Query的幫助。我已經上線試的轉換工具,但沒有運氣... 查詢是這樣的:Linq從C#到VB的查詢轉換:NET

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

有C#在互聯網上VB.NET轉換器,可以給你一個大腦袋開始了很多這方面的東西... – 2012-04-11 14:37:10

+3

好了,你告訴我們,查詢和你需要幫助。這些都不是問題。 **問題是什麼?**您遇到什麼問題? – 2012-04-11 14:38:52

+0

最大的問題是與選擇線... – Jotric 2012-04-11 14:42:44

回答

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 
+0

非常感謝。 – Jotric 2012-04-11 14:52:37

+0

非常感謝您的回放。是的,原來的代碼工作正常。 – Jotric 2012-04-13 06:33:14