I??™m writing this before C# 3 and .NET 3.5 have been fully released, but I??™d like
to make a prediction: in a few years, we??™ll be collectively kicking ourselves for not
using LINQ in a more widespread fashion in the early days of C# 3. The buzz
around LINQ??”both within the community and in the messages from Microsoft??”
has been largely around database access and LINQ to SQL. Now databases are certainly
important??”but we manipulate data all the time, not just from databases but
in memory, and from files, network resources, and other places. Why shouldn??™t
other data sources get just as much benefit from LINQ as databases?
They do, of course??”and that??™s the hidden jewel of LINQ. It??™s been in broad daylight,
in public view??”just not talked about very much. Even if you don??™t talk about
it, I??™d like you to keep it in the back of your mind while you read about the features
of C# 3. Look at your existing code in the light of the possibilities that LINQ has to
offer. It??™s not suitable for all tasks, but where it is appropriate it can make a spectacular
difference.
It??™s only been in the course of writing this book that I??™ve become thoroughly convinced
of the elegance and beauty of LINQ. The deeper you study the language, the
more clearly you see the harmony between the various elements that have been introduced.
Hopefully this will become apparent in the remainder of the book, but you??™re
more likely to feel it gradually as you begin to see LINQ improving your own code.
Pages:
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400