LINQ to Objects in .NET 2.0/3.0 projects
Posted by dariosantarelli on March 1, 2008
LINQ’s query operators are implemented in .NET Framework 3.5. And here lies a difficulty: you might be unsuccessful in demanding that all your customers install Framework 3.5 right away. So what does this mean if you want to code in C# 3.0 and write LINQ queries?
You can use LINQBridge, a reimplementation of all the standard query operators in Framework 3.5’s Enumerable class by Joseph Albahari.
- LINQBridge is designed to work with the C# 3.0 compiler, as used by Visual Studio 2008.
- LINQBridge comprises a “LINQ to Objects” API for running local queries. (It doesn’t include an implementation of LINQ to SQL, nor LINQ to XML).
- LINQBridge also includes Framework 3.5’s generic Func and Action delegates, as well as ExtensionAttribute, allowing you to use C# 3.0’s extension methods in Framework 2.0. In fact
- LINQBridge lets you use nearly all of the features in C# 3.0 with Framework 2.0—including extension methods, lambda functions and query comprehensions. The only feature it does not support is compiling lambdas to expression trees (i.e., Expression<TDelegate>).






