LINQ; DLING; XLING; TO THE FUTURE - YODA
Wow. I was impressed with LINQ strength. Basically you can write query expressions within
your C# codes in near future.
Sometimes I felt quite weird about query languages (say SQL). But I believe it will be handy for
future software development using LINQ.
I believe LINQ will be supported during C# 3.0 days instead of now.
You can download the technology preview here
http://msdn.microsoft.com/netframework/future/linq/default.aspx
Make sure you have at least VS 2005 Beta 2 or VS Express Beta 2.
Below is a snippet code which I learn from the Hands on Labs. Much more to be learn on this.
///
/// New to LINQ
/// Runs on top of C# 3.0, download the tecnology preview
///
static void RetrieveOddOrEvenNumbers()
{// Left hand side does not explicitly defines the type.
// Available only for LINQ - the inference of type information
// directly from compiler.
// Right hand side, the type of numbers is inferred as int[].
var originalNumber = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};// Right hand side is the query expression
var evenNumbers =
from p in originalNumber
where (p % 2) == 0
select p;
var oddNumbers =
from p in originalNumber
where (p % 2) != 0
select p;
Console.WriteLine("<>");Console.WriteLine("<>");// Display the even numbers
foreach (var evenValue in evenNumbers)
{Console.WriteLine(evenValue);
}
Console.WriteLine("<>");// Display the odd numbers
foreach (var oddValue in oddNumbers)
{Console.WriteLine(oddValue);
}
// Do not close down the console window during debugging mode
Console.ReadLine();
}
Other than LINQ, there are also DLING and XLING too. In coming future, there might be even YODA.
I am not suprised to hear this too. Haha!
http://blogs.msdn.com/mattwar/archive/2005/10/09/479008.aspx?CommentPosted=true#commentmessage
Cool :)