我正在使用 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 应该是自动的吧?!
主要写:
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' 中指定的命名空间或类型不包含任何公共成员或找不到。确保命名空间或类型已定义并包含至少一个公共成员。确保导入的元素名称不使用任何别名。