C# in Depth

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

Efficiency of examples

Chapter 10: Extension methods: 10.3.2

Created: 3/4/2008
Last updated: 3/4/2008

Before technical review, the query in listing 10.8 called Where after Reverse - in other words, it was inefficient. I knew about this, and already had the callout to explain how the efficiency could be improved, but Eric suggested that the code in the listing should be the more efficient code to start with.

His reasoning (which I totally agree with) is that sometimes developers take code directly from books, and then fiddle with it until it works for their particular situation - sometimes without reading the surrounding text. Therefore the examples should avoid errors which are then pointed out in the text.

The moral of the story is two-fold: