Simple, Quality, Awesome Software

Errata for the Third Edition

Third Edition Second Edition First Edition

Page 117 - Method parameters have method scope

In the last paragraph of the Variable Scope section, the sentence reads, “The title and author parameters defined at the top of the Book class, by contrast, have method scope.”

The parameters of interest are not at the top of the class, but the top of the Book class’s constructor.

This sentence should read, “The title and author parameters defined at the top of the Book class’s constructor, by contrast, have method scope.”

Page 141 - Modifying the copy, not the original

The book states, “If we aren’t careful, with a mutable, changeable value type, we might think we’re modifying the original, but are instead modifying the original.”

This should read, “If we aren’t careful, with a mutable, changeable value type, we might think we’re modifying the original, but are instead modifying a copy.”

Page 165 - Dictionary of phone numbers vs. ints

In the section called The Dictionary Class it describes how to make a dictionary. Dictionary<TKey, TValue> is a generic class, and you can fill in any value you want for its generic type parameters. However, the book mentions making a Dictionary<string, PhoneNumber>, but then the initial code sample in this section declares a Dictionary<string, int> instead.

This is made worse by the next code block which then populates the dictionary with new PhoneNumber("5550100")PhoneNumber instances.

The first code block should have been:

Dictionary<string, PhoneNumber> phoneBook = new Dictionary<string, PhoneNumber>();

Though alternatively, leaving it as a Dictionary<string, int> could have worked so long as the text around it described it that way and the second code block didn’t use PhoneNumber instances, but ints.

I think the first version, with PhoneNumber instances, is a better choice in most cases though.

Page 338 - Release mode and breakpoints

This item refers to the quiz’s question 4.

The book doesn’t do a good job defining “release mode.” There are two concepts here: whether you are using the Release vs. Debug configuration, and whether you are running with a debugger attached or not. Based on content earlier in the chapter, the intent of release mode is “If you start [your program] in release mode (Ctrl + F5) you won’t be able to debug.” This is the “with a debugger” vs. “without a debugger” concept that the book calls “release mode” and “debug mode.”

Upon reviewing it, I feel like those names are too confusing (and not standard) and lead to enough confusion that I decided to make an errata entry for it.

Whether you stop at breakpoints or not is determined by whether you have a debugger attached. Though in the Release configuration, your code may be optimized and the debugger might stop on the next line for things that got optimized out (like curly brace lines). Whether you get stopped at breakpoints is totally dependent on whether you have a debugger attached, and not whether you are using the Debug or Release configuration.

373 - Size of references and pointers

The size stated for references and pointers is 4 bytes. While this is true on some computers, the vast majority of computers will use 8 bytes for both of these.

The answer depends on whether you are running on a 32-bit machine (32 bits equals 4 bytes) or a 64-bit machine (64 bits equals 8 bytes). These days (and even at the time the book was published in 2017) virtually all desktop and laptop devices were 64-bit, and even most mobile devices were 64-bit as well.

So the answer is that it depends (8 bytes for 64-bit computers and 4 bytes for 32-bit computers) but nearly every computer you run on will probably be 8 bytes, not the 4 bytes listed in the table.

Submit a Problem

If you think you may have found an error (large or small) in the C# Player’s Guide, please let me know about it so that I can get it fixed.

Please email me at rbwhitaker@outlook.com.