I had the exact same problem -- I think that the editors messed up here.
If you download the code for the book from the Wrox web site, you'll see in Chapter 9 that there is a file called "VectorAsCollection.cs" -- this has the indexer in it (see "public double this [uint i]"), plus a getEnumerator() method, which I think the one in chapter 3 is missing.
You'll have to go to the MS C# documentation for an explanation of indexers if you want more data -- that seems to be missing, too. I wonder if some of the text wasn't deleted by the editors when they created this "Professional" version, so that they could get more chapters in?
As a general rule, go with the code on the download site -- I have seen other errors, too, such as the code in the last 4 lines of page 187 -- they omitted the "delegate" keyword from the anonymous method when instantiating EventHandler! This won't compile without that (and the curly braces, I think?). However, there's no correction for this one in their downloadable source code -- I've submitted an errata report to Wrox. Look at the MS C# doc for info on this, too, and I think you'll see that it always has to have the delegate keyword used for these situations.
Good luck!
|