Generic Query Operators for .NET 2.0

I was digging into my blog role today and found a cool link to Standard Query Operators for .NET 2.0 Generics. Microsoft has created a distributable library to expose standard operators for querying objects at runtime OfType... anything. It is great that they provide this to anybody to use in their .NET 2.0 apps, but this will be built into C# 3.0. I see the beauty of this library already... The more I learn about generics and template programming, the more I wonder how I lived without them?

OK, this one took me a minute:

var namesAndOrderIDs =
      Where(c => c.Country == "Denmark").
      SelectMany(c => c.Orders).
      Where(o => o.OrderDate.Year == 2005).
      Select(o => new { o.Customer.Name, o.OrderID });


Print | posted on Thursday, January 26, 2006 4:10 PM