2nd Edition

Page xix - "understand" should be "understanding"

Near the bottom of the page, in the In Depth section, it says, "... not critical to your understand of C#...". This should say, "... not critical to your understanding of C#..." instead.

Page 4 - Grammatical Error: Missing *is*

On page 4, towards the bottom of the page, is a paragraph that starts with, "I should also point out..." Towards the end of that paragraph is a sentence that says "... you can call outside code that not running on a virtual machine." This is missing the word *is* and should probably read: "In other cases, you can call outside code that is not running on a virtual machine."

Page 48 - Extraneous *to*

On page 48 at the start of the 4th paragraph, it reads, "These Convert.ToWhatever methods to convert things besides just strings." That sentence has an extraneous *to* and ought to read, "These Convert.ToWhatever methods convert things besides strings."

Page 72 - && Instead of ||

In chapter 11, after the code sample and before the Try It Out, there's a single paragraph that ends with "You can write the same thing with an if statement as well, using the && operator. This is wrong; it would be the || operator, not the && operator that you would use.

Page 73 - Comment in code explains the while loop backwards

In the section called The While Loop towards the bottom of the page, there are two code blocks. The first one is a simple illustration of how while loops work, but the comment in the middle of the loop is wrong. This comment says, "this code is repeated until the condition is true...". The opposite is the case, in fact. The code is repeated WHILE the condition is true. Or in other words, the code is repeated until the condition is false.

The text above the code explains it correctly when it says, "A while loop will repeat certain code over and over, as long as a certain condition is true."

Page 85 - Totaling vs. Minimum

The Try It Out problem at the bottom of this page talks about totaling and averaging, and mentions a section of code earlier that does each of these, which you then need to modify as a part of the Try It Out problem. The problem here is that there is no code earlier in the chapter that actually does totaling. Instead, there's a section two pages earlier that talks about finding the minimum and averaging.

While writing code to find the total of all items in an array is a useful exercise, the intent of this Try It Out problem was simply to modify the earlier code to use foreach loops instead.

As such, this Try It Out problem really should be titled Minimum and Averaging Revisited, and the first sentence there should state something more like, "Earlier in this chapter, I presented code to go through an array and find the minimum value in an array."

Page 124 - "Two" vs. "To"

I made a grammar mistake when I was typing this one out. On the third line of the second paragraph in the Name Hiding section on page 124, it says, "... which of the two is it referring two?" That second one is the wrong version of "two" and should actually read, "... which of the two is it referring to?"

Page 133 - Missing this

In the second code block on page 133, the SetScore method has a bug. Inside of the if statement, the code should say this.score = 0; instead of simply score = 0;. This is broken because we're setting the local variable (the parameter) to 0 instead of the class-level instance variable. On the next page, where the code is using the property, it is correct. (In that case, score references the instance variable, while value is the name of the parameter.)

Page 150 - Grammatically incorrect/confusing question in the quiz

On page 150, in the Try It Out quiz, the last question is written in a grammatically incorrect and very confusing way. It says, "You can prevent a class can't be derived from (can't be used as a base class)." This doesn't make a whole lot of sense, and probably should just simply read, "You can prevent a class from being used as a base class."

Page 166 - Confusion about IEnumerable

This is probably not really a true "errata", but somebody asked, so I thought I'd mention it.

This section doesn't talk about the namespace that IEnumerable is in. It's in System.Collections.Generic. That means if you want to use this without the fully qualified name, you need to add a using System.Collections.Generic; line at the top of your file.

By default, Visual Studio adds that in to all of your new files, but if you're using Resharper or something like that, the add-ons might remove it because it's not being used. So you may have to manually add it back in yourself.

This can get a little tricky when you realized there's a non-generic IEnumerable in the System.Collections namespace. You don't want to get those two confused. To top if off, the generic IEnumerable is where all the real power lies. If you get the wrong one (the non-generic one) then you won't get the value you were hoping for.

At any rate, this isn't really a typo or anything, but I'll probably add this information into the 3rd edition of this book to help people avoid confusion.

Page 198 - Exception Filters use when not if

The second code block on page 198 shows an example of how to use an exception filter, but it uses the wrong keyword. An exception filter uses when, not if. That code block ought to read more like this:

    throw new Exception("Message");
catch(Exception e) when (e.Message == "Message")
    Console.WriteLine("I caught an exception.");

1st Edition

Page 32 - Billions not Trillions

In Chapter 6 (The C# Type System) on page 32, it states that the range of the int type is roughly -2 trillion to +2 trillion, but then the actual range is given, and it is -2 billion to +2 billion, which is a conflict. The actual number is correct, and the text should have read "...roughly in the rangle of -2 billion to +2 billion..." instead.

Page 48 - Convert.ToSingle not Convert.ToDouble

In Chapter 8 (User Input) on page 48, I state the following:

I use the double type, but float or decimal would accomplish the same task with very little practical difference. (You would have to use Convert.ToFloat or Convert.ToDecimal though.)

That is incorrect, because there is no Convert.ToFloat method. You should use Convert.ToSingle instead.

Ironically, two pages before (page 46) I made a big stink about this, and stated that it was tricky because it was not what you might expect. Then I turned around and typed it incorrectly shortly after. I fell for the thing I warned you about!

Page 119 - Name Hiding Variable Name

In the name hiding section on page 119 on the last paragraph, I state, "We have a class-scoped instance variable called name, but we also have a method-scoped parameter called name. The code that I'm referring to, on page 118, does not have anything called name. The code uses the name title instead. The text here on page 119 should say title, not name.

This error is likely because the code originally called the variable name, but I chose later to pick something more descriptive for the book's title, and switched it over to title.

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