Errata: June 26, 2019

Thank you for purchasing C# in Depth, Fourth Edition . If you find an error, not listed below, please add it to LiveBook Errata thread. We'll update this list as necessary. Thank you!


Page 9

A closing bracket is missing the second example. The code should be:

throw new KeyNotFoundException(
    string.Format("No calendar system for ID {0} exists", id));

Page 35

The declaration for the LastOrDefault method is missing the type parameter T. The first line should be

public T LastOrDefault<T>(IEnumerable<T> source)

Page 397, listing 13.13

The code in the Main method on page 397 is incorrect. Please replace it with the following:

static void Main()
{
    int x = 10;
    InParameter(x, () => x++);

    int y = 10;
    ValueParameter(y, () => y++);
}

Page 417

The word Mostly should be most as follows:

Most of the time you won’t even notice them, and you can refer back to this section if the compiler complains about code that you expect to be valid.