.NET 3.0 and C# 3.0

November 10, 2006

.NET 3.0 was released earlier this week, to very little fanfare. I haven’t done much to prepare for it, and from what I’ve read so far there’s not much reason to unless you’re already building applications for Vista. The Windows Presentation Framework looks neat, but not something I’d use at work, where I do nearly all of my .NET development.

What really caught my eye as I was reading was LINQ, one of the upcoming features in C# 3.0 (which is not included in WinFX 3.0 .NET 3.0, and won’t be released for a while; confused yet?). Here’s a little code sample from the website which illustrates what it’s all about.


using System;
using System.Query;
using System.Collections.Generic;

class app {
  static void Main() {
    string[] names = { "Burke", "Connor", "Frank",
                       "Everett", "Albert", "George",
                       "Harris", "David" };

    IEnumerable expr = from s in names
                               where s.Length == 5
                               orderby s
                               select s.ToUpper();

    foreach (string item in expr)
      Console.WriteLine(item);
  }
}
</code></pre>
This is just a simple data query, but what's exciting is that it's built into the language itself, and you can use it on any object which implements the IEnumerable interface. Here it's an array, but it could just have easily been an MS SQL database or an XML file. Data handling has always been one of .NET's strengths compared to other languages and platforms, and with stuff like LINQ in the works I don't think that's going to change any time soon.

Marc Charbonneau is a mobile software engineer in Portland, OR. Want to reply to this article? Get in touch on Twitter @mbcharbonneau.