我正在从 C# 转换这个 LINQ 表达式。但是,它似乎不起作用。
C#
return (from w in fishSticks
group w by w.FishQty into g
orderby g.Key descending
select g).First().First();
VB
Return (From w In fishSticks
Group w By w.FishQty Into g()
Order By g.Key Descending
Select g).First().First()
Visual Studio 转
Into g
进入 Into g()
本身然后给我这个错误:Definition of method 'g' is not accessible in this context.
有任何想法吗?
最佳答案
VB.Net has different group syntax
正确的语法是
Dim q = (From w In fishSticks
Group By Quantity = w.FishQty Into g = Group
Order By Quantity Descending
Select g).First().First()
关于vb.net - 如何在 VB.NET 中使用 "Into"LINQ 表达式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2668163/