Martyn

Martyn Bullerwell's Blog

LINQ

The LINQ Project is fast becoming one of the most anticipated integrated technologies in Visual Studio 2008 (ORCAS).  LINQ is simply a set of extensions to the .NET framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities.

Microsoft have seen that the next big challenge in programming technology is to reduce the complexity of accessing and integrating information that is not natively defined using OO technology. The two most common sources of non-OO information are relational databases and XML.

Put simply, the new extensions, allow you to easily perform database type queries directly in code! Standard query operators allow queries to be applied to any IEnumerable<T> based information source. 

Here are some sample snippets, taken straight from Microsoft's web site...

 

using System;
using System.Linq;
using System.Collections.Generic;

class app

{
static void Main()

{
  string[] names = { "Burke", "Connor", "Frank",
 "Everett", "Albert", "George",
 "Harris", "David" };

    IEnumerable<string> query = from s in names
    where s.Length == 5
    orderby s
    select s.ToUpper();

   foreach (string item in query)  Console.WriteLine(item);
 }
}

As you can see in this very simple snippet of code, the idea is to mimic syntax of T-SQL, and if it is as good as it looks so far we may have a lot more to say on it....

I'm sure there will be more to come!

Loading