views:

188

answers:

4
+1  Q: 

VS2005 and LINQ

Can I use LINQ within VS2005 if I have .NEt 3.5 installed?

+3  A: 

There is no direct compiler support for LINQ in VS 2005.

You can still use the LINQ namespace and methods, however, it is not as elegant as using it in VS 2008.

See this article for details.

Reed Copsey
+6  A: 

The thing to remember is that at it's core Visual Studio, like any IDE, is a glorified text editor with an integrated debugger, and maybe a few other features as well. You could certainly use Visual Studio 2005 to input the code text of your linq program and then use the .Net 3.5 command line compiler to build it. You might even be able to find or write an add-in to automate the build process.

That means the technically correct answer to your question is, "Yes."

However, you won't get any extra IDE support:

  • Incorrect/broken intellisense.
  • Incorrect/broken syntax highlighting
  • Inability to work with .Net 3.5+ solution files.
  • No debugger support

The result is that you would probably be better served if I had simply said, "No."

If you already have 2005 but not 2008, you have a few options:

  • Get the 2008 Express Edition
  • Use a third-party tool like #Develop
  • Buy a 2008 full edition
Joel Coehoorn
i.e. Just because you *can* doesn't mean you *should*.
Bob King
+1  A: 

Vs2005 and C# do not directly support Extension Methods, Lambda Expression, Anonymous Types or Expression Trees which are key enabling features of LINQ. Some of the early LINQ betas did work with VS2005 and C# but none of the release products.

Likely the same for VB but I can't directly comment on VB other than I am about 99.99% sure you can't.

Andrew Robinson
+1  A: 

Simple answer is no. LINQ relies on language features (such as extension methods) that VS2005 does not support.

Hldev Zkran