I seem to be missing something about LINQ. To me, it looks like it\'s taking some of the elements of SQL that I like the least and moving them into the C# language and usin
Because linq is really monads in sql clothing, I'm using it on a project to make asynchronous web requests with the continuation monad, and it's proving to work really well!
Check out these articles: http://www.aboutcode.net/2008/01/14/Async+WebRequest+Using+LINQ+Syntax.aspx http://blogs.msdn.com/wesdyer/archive/2008/01/11/the-marvels-of-monads.aspx
From the first article:
var requests = new[]
{
WebRequest.Create("http://www.google.com/"),
WebRequest.Create("http://www.yahoo.com/"),
WebRequest.Create("http://channel9.msdn.com/")
};
var pages = from request in requests
select
from response in request.GetResponseAsync()
let stream = response.GetResponseStream()
from html in stream.ReadToEndAsync()
select new { html, response };
foreach (var page in pages)
{
page(d =>
{
Console.WriteLine(d.response.ResponseUri.ToString());
Console.WriteLine(d.html.Substring(0, 40));
Console.WriteLine();
});
}