Geeks With Blogs
A little something... Still a long way to go

Now that VS 2005 RTM is out and pretty much visible among the developer community, I thought of what next. I happened to come across C# 3.0 and among the new features the one I liked much is LINQ . LINQ is an acronym for .NET Language Integrated Query. It helps to use general query notation for operations like selection, filtering etc on any IEnumerable <T> based datasource. You can read about this more from Don Box's article at MSDN .

I tried some code snippets and found it pretty good. Notably, the syntax. It gives the same familiarity as good old SQL does. My code snippet looked like -

string[] color = { "violet", "indigo", "blue", "green", "yellow", "orange", "red"};

var result =   
from c in color
where c.Length > 3 
select c;

foreach (var c in result)


Another alternative to achieving the same results could have been -

foreach(string s in color)
    if (s.Length > 3)

And as usual I did a little timing test to see how the two went. There wasn't much of a difference between the two, the foreach loop just took a bit lesser time. But frankly this was no benchmarking. Probably if you are really keen for some analysis, you can check up Jon Skeet's post here.

So keen to try something new, go ahead and try LINQ. You can download the installer from here. Till then happy LINQ'ing :-).


Posted on Tuesday, February 21, 2006 2:42 PM ChkThis and ScanThat | Back to top

Comments on this post: What's up?

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Humtee Dumbtee | Powered by: