tags:

views:

90

answers:

3

I need to use linq in C# Windows form application working with .Net Framework 2 not 3.5 . I Know it may be some sort of stupidity to do that. but i need that for some special reasons. Can i import just linq libraries to my project by anyway ? or there is no way except for using 3.5 ?

+7  A: 

Yes, up to a point. Take a look at LINQBridge.

LukeH
Great Answer but, isn't there any way to do that for Linq to SQL ?? as this method doesn't seem to implement Linq to SQL
EgyEast
I'm not sure. The blog post that Justin links to suggests that it's possible if you're running 2.0sp1.
LukeH
You just saved my day. Thanks!
mizipzor
+3  A: 

There are several blogs which outline this process (yes, it can be done):

LINQ support on .NET 2.0

Justin Niessner
A: 

The core of the framework 3.5 is the same as the core of framework 2.0 For instance you can create a solution with vs 2008 where your front-end project or user interface will compile with the framework 2.0, and a core dll project with framework 3.5 that uses linq extensively. The whole thing can be deployed in a 2.0 environment without problems.

eloycm
The core of the framework might be the same, but LINQ is 3.5 only. So it won't run on a machine with only .NET 2.0 (other than by using the workaround/hack linked by @Justin)
Matt Warren
LINQ is a language feature, so you need the VB9 compiler to compile it, but the resulting IL is compatible with v2.0 of .Net. If you used any classes or namespaces that were unique to 3.5, then you would need 3.5 installed.
Chris Dunaway