【发布时间】:2012-10-26 14:02:14
【问题描述】:
我正在使用 vs2008 框架 3.5,我第一次关注 linq,遵循这些 http://msdn.microsoft.com/it-it/library/bb385164(v=vs.90).aspx
像这样创建数据源http://msdn.microsoft.com/it-it/library/bb385204(VS.90).aspx
但我无法导入/使用 linq。制作 consoleApplication System.Core.dll 引用和导入 System.Linq 应该是自动的吧?!
写在main中:
Dim students = GetStudents()
'Dim students As List(Of Student) = GetStudents() 'the same thing with this one
Dim studentQuery = From currentStudent In students _
Where currentStudent.Rank <= 10 _
Select currejt
IDE 不喜欢查询中的学生并说:
Error 1 Expression of type 'System.Collections.Generic.IEnumerable(Of ConsoleApplication1.Module1.Student)'
is not queryable. Make sure you are not missing an assembly reference and/or namespace
import for the LINQ provider. ConsoleApplication1
我哪里错了!?
如果我尝试“导入 System.Linq”,它会显示
警告 1 在 Imports 'System.Linq' 中指定的命名空间或类型 不包含任何公共成员或找不到。确保 命名空间或类型已定义并包含至少一个公共 成员。确保导入的元素名称不使用任何别名。
【问题讨论】:
-
嗯做你有对 System.Core 的引用吗?
标签: .net vb.net linq visual-studio-2008 .net-3.5