需要有关使用动态 LINQ 库的 LINQ 查询的帮助
请原谅我对此的无知。 我有这个 LINQ 查询: Dim ngBikersDataContext As New CarBikeWalkDataContext
bikersList = (From c In ngBikersDataContext.Reg_Bikers _
Order By c.L_Name _
Select New Bikers() With { _
.BikerID = c.BikerID, _
.F_Name = c.F_Name, _
.M_Name = c.M_Name, _
.L_Name = c.L_Name _
}).ToList()
如您所见,它是一个 LIST(OF )。以下是 bikersList 的定义:
Dim bikersList As List(Of Bikers) = TryCast(HttpContext.Current.Session("Bikers"), List(Of Bikers))
我需要能够排序,因此将使用动态 LINQ 库。因此,我将其添加到我的项目 Imported System.Linq.Dynamic 中并尝试使用此代码:
bikersList = (ngBikersDataContext.Reg_Bikers _
.OrderBy(SortExpression) _
.Select New Bikers() With { _
.BikerID = c.BikerID, _
.F_Name = c.F_Name, _
.M_Name = c.M_Name, _
.L_Name = c.L_Name _
}).ToList()
但现在我在下面看到蓝色的 scwiggly 线:
ngBikersDataContext.Reg_Bikers _
.OrderBy(SortExpression) _
.Select
并显示错误“重载解析失败,因为没有可访问的“选择”接受此数量的参数。 ” 在“NEW”上我收到一个错误“')'expected”。
有人请告诉我我做错了什么吗? 谢谢
Forgive my ignorance on this.
I have this LINQ Query:
Dim ngBikersDataContext As New CarBikeWalkDataContext
bikersList = (From c In ngBikersDataContext.Reg_Bikers _
Order By c.L_Name _
Select New Bikers() With { _
.BikerID = c.BikerID, _
.F_Name = c.F_Name, _
.M_Name = c.M_Name, _
.L_Name = c.L_Name _
}).ToList()
As you can see it is a LIST(OF ). Here is the definition of the bikersList:
Dim bikersList As List(Of Bikers) = TryCast(HttpContext.Current.Session("Bikers"), List(Of Bikers))
I need to be able to sort, so was going to use the Dynamic LINQ Library. So I added it to my project Imported System.Linq.Dynamic and tried to use this code:
bikersList = (ngBikersDataContext.Reg_Bikers _
.OrderBy(SortExpression) _
.Select New Bikers() With { _
.BikerID = c.BikerID, _
.F_Name = c.F_Name, _
.M_Name = c.M_Name, _
.L_Name = c.L_Name _
}).ToList()
But now I am getting the blue scwiggly line under:
ngBikersDataContext.Reg_Bikers _
.OrderBy(SortExpression) _
.Select
with the error "Overload resolution failed because no accesible 'Select' accepts this number of arguments."
Over the "NEW" I get an error " ')'expected."
Would someone please tell me what I am doing wrong.
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将“扩展方法”语法与“查询语法”混淆了。
或者
You're mixing up 'extension method' syntax with 'query syntax'.
Or