C# in Depth

Cover of C# in Depth
Order now (3rd edition)

(You are currently looking at the first edition version of this page. This page is also available for the second and third editions.)

Errata for Chapter 12: LINQ beyond collections

P317, second bullet: Renamed associations

On page 317, I mention in the second bullet that I renamed the parent and child properties used for the associations between Defect and DefectUser but I didn't say what I did with them. Anyone following along would have trouble with their code later on if they didn't happen to choose the same names as me. To fix this, add the following text to the end of the second bullet:

I named the relationships AssignedTo/AssignedDefects and CreatedBy/CreatedDefects.

P329, listing 12.7: Use the expression type in CreateQuery!

In the nongeneric implementation of IQueryProvider.CreateQuery, I'm ignoring the type of the expression and always returning a FakeQuery<object>. Instead, it should return a query based on expression.Type. The easiest way to do this is probably to call the generic method via reflection, or call the FakeQuery<T> constructor directly with Activator.CreateInstance.

P349, listing 12.22: Alignment in query

The alignment of the query in listing 12.22 is incorrect. It should be:

var query = from name in names.AsParallel(3)
            select ObtainLengthSlowly(name);