Thursday, April 12, 2007 6:44 PM bart

LINQ-SQO v0.9 RTW

Wanna know how the "Standard Query Operators" (a.k.a. LINQ-to-Objects) in LINQ work? Beginning of this month, I released the 0.9 release of the LINQ-SQO "fun project" on CodePlex at http://www.codeplex.com/LINQSQO. The project is intended as a useful reference tool when talking about the internals of LINQ.

This project contains a custom implementation of the LINQ-to-Objects API of Microsoft's LINQ project, i.e. a "clone" of the System.Linq.Enumerable class. You can download the sources via the releases page. The download includes a complete test harness as well, containing around 150 unit tests.

A cool new feature of this release is the fact that the whole solution can be compiled using C# 2.0 in Visual Studio 2005. Only if you define "CS30" in the project, the C# 3.0 specific features (extension methods in this case) will be included inside the source code. This allows to illustrate LINQ in a C# 2.0 context:

IEnumerable<Person> source = ...; // Get input somewhere IEnumerable<Person> results = Enumerable.Select( Enumerable.Where( source, delegate (Person p) { return p.FirstName.StartsWith("B"); } ), delegate (Person p) { return p.FirstName + " " + p.LastName; } );

as the C# 2.0 equivalent for:

IEnumerable<Person> source = ...; // Get input somewhere var res = from p in source where p.FirstName.StartsWith("B") select p.FirstName + " " + p.LastName;

Ultimately, for apps that use LINQ-to-Objects, you should be able to replace "using System.Linq;" with "using BdsSoft.Linq;" and still get the same results back, without touching any LINQ(-to-Objects) queries in your code. However, you shouldn't do this in production-quality code; this project doesn't have any kind of support and is only intended as a sample, for reference purposes only. See license page for more details.

Enjoy!

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Filed under:

Comments

# LINQ-SQO v0.9.1 (for Orcas Beta 1) RTW

Monday, April 30, 2007 11:00 AM by B# .NET Blog

A couple of weeks ago I announced the availability of LINQ-SQO v0.9 (Release Candidate). Today the project