Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > BOOK: Professional C# 2005
|
BOOK: Professional C# 2005
This is the forum to discuss the Wrox book Professional C# 2005 by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones; ISBN: 9780764575341
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2006, 06:50 AM
Registered User
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 9 - Collection support.

Under "Adding collection support to the Vector struct" it says that the vector struct started in chapter 3. Looking at the errata, that is wrong, it should be chapter 5. So far so good.

But then it is mentioned that it is possible to treat the Vector instance as an array, using indexers from chapter 3. Up to this point I haven't read anything about treating structs (or classes) as arrays. Looking at the source code I can see that it is there, but it is never mentioned in the book - at least I haven't read anything about that in the previous chapters.

Can someone explain?

Regards, Henrik

 
Old April 29th, 2006, 07:39 AM
Registered User
 
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Error-Object does not support doesn't support this bootsy Classic ASP Basics 1 May 25th, 2008 07:14 PM
Collection Class chapter 5 eggspencer BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 1 November 27th, 2006 04:46 PM
Collection in C# ? dedex C# 1 January 14th, 2005 04:51 PM
COM Collection ben0027 Visual C++ 0 May 1st, 2004 05:19 AM
Help collection gone MikeB VS.NET 2002/2003 2 June 12th, 2003 02:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.