|LINQ to Objects Using C# 4.0|
Author: Troy Magennis
LINQ to Objects is the place that the whole technology starts and it's the place that LINQ is most likely to find a place in your program.
This is a book on a very focused topic - LINQ to Objects. Notice that this doesn't cover LINQ to SQL or Entities or any other LINQ technologies. I'm very much in favour of focused books because there is a tendency to create huge volumes that cost a lot, are heavy and next to impossible to read. You can see the logic of the fat book - cover everything and you get a bigger audience. However if that audience is mostly dissatisfied with their purchase it might just backfire.
In this case we have a very reasonable 336 pages devoted to LINQ to Objects. Why pick this particular application of LINQ? It can be argued that LINQ to Objects is the place that the whole technology starts and it's the place that LINQ is most likely to find a place in your program. Not everyone works with SQL or any sort of database but we all tend to use classes that implement IEnumerable and this is what LINQ to Objects deals with. It provides a way of querying and manipulating in memory collections. There are some programmers who claim that it provides a better way to implement iteration. Instead of writing for loops that not only defined what to do but how to do it you should write a query which simply says what is to be done. Not everyone agrees with this idea but you should at least be aware of it.
The book starts off with an overview of LINQ and I have to say that it is at this point the messy layout starts to make the book seem more confusing and complex than it actually is. Then we have an introduction to LINQ which also covers the facilities introduced into C# to make LINQ possible - extension methods, object initializers, implicit and anonymous types and lambda and query expressions. From here we move into the details of writing query expressions and if you already know SQL this is where the book will seem to be laboring the point. Query expressions are modeled on SQL and so if you know one you almost know the other - this was of course the intention if the LINQ designers.
Chapter 4 moves us into territory that should be just as familiar but even experienced SQL and LINQ programmers find the idea of the join and the practice of grouping difficult. The chapter covers the basics and the more advanced ideas such as the one-many join. The next chapter returns to consider the query in the wider context and introduces the query operators that haven't been encountered earlier in the book. Chapter 6 deals with set operations in detail.
The final few chapters are on more advanced and specialized topics such as extending LINQ by writing your own query operators, C# 4.0 features and Parallel LINQ - PLINQ. The extension of LINQ to parallel implementation is an example of the principle that LINQ expressions state what is to be done and not how it is to be done - this is why the query approach to data manipulation is so powerful and idea.
Overal this is a very good book spoiled only a little by a messy layout.
|Last Updated ( Saturday, 05 June 2010 )|