|
-
Jan 15th, 2012, 10:59 AM
#1
Thread Starter
Lively Member
Linq not working after .Net 2.0 to 3.5
I started developing an application several weeks ago and decided today that I may want to use LINQ. So I changed my project from .NET Framework 2.0 to 3.5 and restarted the program.
However, I can not get the most basic LINQ statement to work. I thought it was my code until I started a blank .NET 3.5 project and inserted the basic code (below) which worked without issue. So I then started another .NET 2.0 project and inserted the code (which I knew wouldn't work) and the errors are the same as the project that I converted. So next I converted this new .NET 2.0 to 3.5 and the code still doesn't work. So migrating from 2.0 to 3.5 isn't working for LINQ.
My question is: If one changes from a .NET 2.0 to a .NET 3.5 how do they get LINQ to work properly?
Thanks in advace for your suggestions. 
Code:
' Data source.
Dim numbers() As Integer = {0, 1, 2, 3, 4, 5, 6}
' Query creation.
Dim evensQuery = From num In numbers
Where num Mod 2 = 0
Select num
' Query execution.
For Each number In evensQuery
Console.Write(number & " ")
ListBox1.Items.Add(number)
Next
Last edited by chemaster; Jan 15th, 2012 at 11:02 AM.
-
Jan 15th, 2012, 11:24 AM
#2
Re: Linq not working after .Net 2.0 to 3.5
Did you check your references to see if you still have a reference to the LINQ library? And did you import LINQ?
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Jan 15th, 2012, 11:32 AM
#3
Re: Linq not working after .Net 2.0 to 3.5
Yeah. I just tested it. You have to import System.Linq.
Just for future reference, you should always look up errors either directly at MSDN or just doing a search, before coming to the forums.
I looked up this message and found an article on MSDN that you can read here.
Queryable types are defined in the System.Linq, System.Data.Linq, and System.Xml.Linq namespaces. You must import one or more of these namespaces to perform LINQ queries.
Last edited by weirddemon; Jan 15th, 2012 at 11:36 AM.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|