Results 1 to 3 of 3

Thread: Linq not working after .Net 2.0 to 3.5

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    75

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width