C#

The Bonus Site for C# 2008 For Dummies
csharp102.info

Factual Errors in the Book

Errors on this page are factual errors that could lead you astray (as opposed to more cosmetic things affecting only appearance).

  • Page 6, under "About the Web site." I missed changing this paragraph after we decided to put the bonus materials on a Web site rather than on a CD-ROM. The paragraph should read as follows:

    The Web site contains a host of goodies. First, you find an expanded collection of all the source code from this book. Second, you find seven additional bonus chapters. Finally, you find a collection of resources. These include a Frequently Asked Questions (FAQ) page, a variety of bonus articles plus references to useful books and articles you can find elsewhere, and links to several very useful utility programs, such as SharpDevelop, NUnit, and Reflector.
  • Page 17, list item b, last sentence (in parentheses). Change the following:

    (The directory may already exist if you've installed the example programs from the Web site.)

    to the following:

    (You need to create the following directory: C:\C#Programs. Then install the programs there from the Web site.)
  • NEW!! (4/2/08) Page 31, the BigInteger section. Well, this one's a bit of a doozy. The C# specification document listed BigInteger as one of the new features, so I dutifully wrote about it -- but didn't really check it out or try using it. What use do I have for such a beast? What use do you have? Most For Dummies readers won't have ANY use for it in all likelihood. As it turns out, there is a BigInteger class, but it's hidden away inside the cryptography library in the .NET Framework libraries. Not public, not directly usable in C#. There is a sort of twisted back-door way to get at it, by using a companion .NET language called J# (a part of Visual Studio 2008 Standard and above) -- which does make a big integer implementation available. You have to include a J# library in your C# program to use it. So it is there, sort of. Anyway, my apologies for not having checked it out more carefully before writing about it. For more information, you can check it out at msdn2.microsoft.com/en-us/magazine/cc163696.aspx.

  • Go to Top

  • Page 99, in the listing of the BubbleSortArray program, 17 lines down from the top of page 99. The statement assigning the planets array to the sortedNames array before sorting is a coding error--here's the line: string[] sortedNames = planets;

  • This line does NOT copy the contents of planets into sortedNames, as I indicated. Instead, it just points the sortedNames array reference to the planets reference. Both arrays point to the same data. Thus when I sort sortedNames, I sort both arrays in effect. Not what I intended. What I needed to do was use the Array.CopyTo() method to copy planets into sortedNames. The corrected code looks like the following:

    string[] sortedNames = new string[planets.Length];

    planets.CopyTo(sortedNames, 0);

    Array.Sort(sortedNames);

    This creates the sortedNames array, then copies planets to sortedNames, and sorts sortedNames. The planets array is not sorted--which is what I intended.

    Thanks to reader Brian Ripley for this one.

  • Page 110, line 2 in the first paragraph, following the first code fragment. The Help search instruction should read "Look up dictionary in the Help Index. This gets you to the entry 'Dictionary(Of TKey, TValue)'. Click the 'initializing' entry under that item." (Note that this is Visual Basic syntax, but it gets you to C# information too.)

  • Page 268, first line of output section at bottom of page. The line printed is actually "Invoking SubClass() default".

  • Page 273, Figure 12-1. The middle line in the figure has an extraneous parenthesis. Delete the middle one, ')'.

  • Page 309, second block of code. The return statement in the CreateRecorder method is missing a required cast. Since the method returns an IRecordable, not a Pen, the newly created Pen must be cast to an IRecordable. The code should look like this:

    if(recorderType == "Pen") return (IRecordable)new Pen();
  • Page 312, first line of code on the page. The Console.WriteLine call is missing a quote mark on its format string:

    "{0}, disp.Display()

    should be

    "{0}", disp.Display()
  • Page 401, last paragraph. Instead of being in Bonus Chapter 5, the example mentioned is in the article "Querying an Object As a Collection with LINQ" on this Web site. Click the Articles link on the Home page.

Go to Top