Sunday, December 9, 2007

Visual studio 2008

I downloaded express C# edition of Visual studio 2008. I'm fascinated with LINQ new query language extensions which consolidates concepts of functional programming. LINQ brings in new concise style of writing queries which works with any data source not just Relational stuff. You have all standard query operators defined for LINQ that operate with compatible data sources which implement IEnumerable interface..

Here's small snippet that gives glimpse of LINQ

var string[] s = { apple, boy, cat};
IEnumerable query = from s in names
where s.Length == 3
orderby s
select s.ToUpper();
Console.WriteLine("*****Simple QueryExpression using LINQ infrastructure in C#3.0");
foreach (string item in query)
Console.WriteLine(item);

here I would like to hint about new Implict typed local variables, new feature introduced in C# 3.0. Observant readers will find "var" keyword to be a implicit typed local variable. Implicit typed local variables will deduce the type from the initialized value.

For ex:
var x = 3 will result in treating x as integer based on value assigned to it.

Ok, let's try to understand above snippet..

All query expressions in LINQ begin with FROM clause.. there's much more into it.. Give me some time...as I'm learning bits and pieces of it

Listen to this beautiful video featuring Anders Hejlsberg, Chief Architect of C# giving good insights into LINQ and functional programming

http://blogs.msdn.com/charlie/archive/2007/01/26/anders-hejlsberg-on-linq-and-functional-programming.aspx