Net30.LinqBridge
1.6.0.2
dotnet add package Net30.LinqBridge --version 1.6.0.2
NuGet\Install-Package Net30.LinqBridge -Version 1.6.0.2
<PackageReference Include="Net30.LinqBridge" Version="1.6.0.2" />
<PackageVersion Include="Net30.LinqBridge" Version="1.6.0.2" />
<PackageReference Include="Net30.LinqBridge" />
paket add Net30.LinqBridge --version 1.6.0.2
#r "nuget: Net30.LinqBridge, 1.6.0.2"
#:package Net30.LinqBridge@1.6.0.2
#addin nuget:?package=Net30.LinqBridge&version=1.6.0.2
#tool nuget:?package=Net30.LinqBridge&version=1.6.0.2
LINQBridge
You might already have discovered that LINQ is addictive: once you're accustomed to solving problems through slick functional queries, it really hurts being forced back to the imperative style of C# 2.0!
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?
The good news is that there is a solution. It relies on two things:
- Visual Studio 2008's multi-targeting feature
LinqBridge.dll(a 60KB assembly)
With Visual Studio's multi-targeting and LINQBridge, you'll be able to write local (LINQ to Objects) queries using the full power of the C# 3.0 compiler and yet your programs will require only Framework 2.0.
LINQBridge is a re-implementation of all the standard query operators in
Framework 3.5's System.Linq.Enumerable class. It's 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; a good
compromise can be to force Framework 3.5 out to just the server machines,
allowing LINQ to SQL to be used where it's needed most).
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>).
How does it work?
First, it's important to understand that C# 3.0 and Framework 3.5 are designed to work with CLR 2.0, the same CLR version that Framework 2.0 uses. This means that the C# 3.0 compiler emits IL code that runs on the same virtual machine as before.
This makes Framework 3.5 additive, just as Framework 3.0 was additive, comprising additional assemblies that enhance the existing 2.0 Framework and CLR. So there's nothing to stop us from writing our own assemblies that do the work of Framework 3.5 (at least, the critical bits required for local LINQ queries).
But, you might ask, don't LINQ queries depend on Framework 3.5? Strictly speaking, they don't. C# 3.0 expects that certain method signatures be present, which Framework 3.5 just happens to provide. For example, consider the following LINQ query:
int[] numbers = { 5, 15, 7, 12 };
var query =
from n in numbers
where n > 10
orderby n
select n * 10;
In compiling this, C# 3.0 first translates it to:
var query = numbers
.Where (n => n > 10)
.OrderBy (n => n)
.Select (n => n * 10);
The compiler then looks for Where, OrderBy and Select methods. The
critical thing is that it can find appropriately named methods with the
correct signatures (typically extension methods). But it doesn't matter what
assembly the methods come from. LINQBridge simply provides another source of
these methods that are functionally identically to those implemented in the
Framework 3.5 assemblies.
How to use LINQBridge
LINQBridge requires Visual Studio 2008 (or the standalone C# 3.0 compiler, if you're keen). First, go to project properties, and change the Target Framework to 2.0 or 3.0:
This is a safeguard that prevents you from accidentally referencing Framework
3.5 assemblies. If your project already references System.Core, the
reference will be greyed out (you can safely delete it).
The next step is to add a reference to LinqBridge.dll.
That's all there is to it, now you can start writing LINQ queries!
When all of your clients later upgrade to Framework 3.5, you can upgrade your
project simply by changing the Target Framework back to 3.5 and replacing the
LINQBridge reference with System.Core. LINQBridge uses the standard LINQ
namespaces, so no code edits will be required.
What if Framework 3.5 is Installed?
The presence of Framework 3.5 does not impede LINQBridge in any way. If your
project references LINQBridge during compilation, then it will bind to
LINQBridge's query operators; if it references System.Core during
compilation, then it will bind to Framework 3.5's query operators.
Can I use LINQBridge with C# 2.0 and Studio 2005?
You can, but the query operators will be awkward to use without lambda expressions, extension methods, query syntax, etc.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net20 is compatible. net30 is compatible. net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 2.0
- Net35.Actions (>= 1.4.0.2)
-
.NETFramework 3.0
- Net35.Actions (>= 1.4.0.2)
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (12)
Showing the top 5 NuGet packages that depend on Net30.LinqBridge:
| Package | Downloads |
|---|---|
|
Net4x.Text.RegularExpressions
Provides the System.Text.RegularExpressions.Regex class, an implementation of a regular expression engine. |
|
|
Net4x.BaseTypes
Package Description |
|
|
Net4x.ValueTuple
Package Description |
|
|
Net35.TypeInfo
Provides resource pooling of any type for performance-critical applications that allocate and deallocate objects frequently. |
|
|
GrindCore
Native Compression and Hashing library built the System.IO.Compression way. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Net30.LinqBridge:
| Repository | Stars |
|---|---|
|
SabreTools/SabreTools
DAT management tool with advanced editing and sorting features
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.6.0.2 | 2,410 | 12/30/2025 |
| 1.6.0.1 | 6,456 | 11/30/2025 |
| 1.6.0 | 25,862 | 3/31/2025 |
| 1.3.0 | 51,151 | 8/26/2023 |
| 1.3.0-at20230430033728 | 9,560 | 5/7/2023 |
| 1.3.0-at20230411060303 | 16,411 | 4/14/2023 |
| 1.3.0-at20230409090859 | 318 | 4/9/2023 |
| 1.3.0-at20230409083429 | 267 | 4/9/2023 |
| 1.3.0-at20230409060423 | 281 | 4/9/2023 |
| 1.3.0-at20230408 | 280 | 4/8/2023 |