First Look at LINQ


I have been wanting to look into LINQ for quite sometime and finally last week, due to the requirements of our current project I had to quickly get into it and use it.
My first impression is that although a bit tricky to get your head around terms like Expression Tree’s , Lambda Expressions, and Extension Methods etc, once your understand the tricky notations it really is fascinating what you can do with it.

Last week I attended a London.net user group meeting on DSL and realized how much Domain Driven Development is being utilized in LINQ , and that is surly one of the upcoming development methodologies , so one thing is for sure that I need to spend much more time understanding LINQ and the related technologies.

A simple LINQ to Object example looks something like this

string[] presidents = {

“Adams”, “Arthur”, “Buchanan”, “Bush”, “Carter”, “Cleveland”,

“Clinton”, “Coolidge”, “Eisenhower”, “Fillmore”, “Ford”, “Garfield”,

“Grant”, “Harding”, “Harrison”, “Hayes”, “Hoover”, “Jackson”,

“Jefferson”, “Johnson”, “Kennedy”, “Lincoln”, “Madison”, “McKinley”,

“Monroe”, “Nixon”, “Pierce”, “Polk”, “Reagan”, “Roosevelt”, “Taft”,

“Taylor”, “Truman”, “Tyler”, “Van Buren”, “Washington”, “Wilson”};

IEnumerable<string> items = presidents.Where(p => p.StartsWith(“A”));

foreach (string item in items)

Console.WriteLine(item);

The LINQ Project is hosted here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s