I’m using vs2008 framework 3.5 and i’m looking about linq for first time, following these http://msdn.microsoft.com/it-it/library/bb385164(v=vs.90).aspx
Creating data source like this http://msdn.microsoft.com/it-it/library/bb385204(VS.90).aspx
But i can’t import/use linq. Making a consoleApplication System.Core.dll reference and imports System.Linq should be automatic right?!
writing in 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
The IDE doesn’t like students in the query and says:
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
where i’m wrong!?
If i try ‘Imports System.Linq’ it says
Warning 1 Namespace or type specified in the Imports ‘System.Linq’
doesn’t contain any public member or cannot be found. Make sure the
namespace or the type is defined and contains at least one public
member. Make sure the imported element name doesn’t use any aliases.
Reference and import are different – you have to reference that dll from your project (System.Core, where the System.Linq namespace resides) in order to be able to import it to your class…
Right click Project / References, choose add reference, go to tab “.NET” and select System.Core.