Errata

C# 12 in a Nutshell

Errata for C# 12 in a Nutshell

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date Submitted
Printed Page 529-530
between pages

Missing content

The text introduces FirstNode, LastNode, and Nodes on end of page 529

Expected continuation on page 530: Example for FirstNode, LastNode
Present continuation on page 530: Rest of an incomplete example for Nodes.
The variable bench is not introduced but used.

Markus Wimmer  Nov 15, 2024 
Printed Page 273
Ch4-Advanced C#-XML Documentation-Second bullet point

Books mentions Sandcastle and NDoc as tools for generating documentation from XML comments. These tools are +15 years old at this point

Anonymous  Jul 24, 2024 
Printed Page 226 Ch4-Tuples
code example at top of page

opening ( missing for `string int char) ...`

Anonymous  Jul 23, 2024 
Printed Page 206
Iterator code example

A open curly brace is missing in the Fibonacci example.

Romain LHOTTE  Jul 18, 2024 
Printed Page 45
top code example

Point p = null;

does not work in the default c# 12 / .net 8 project

You have to do

Point? p = null;

Anonymous  Jul 17, 2024 
Printed Page 180
Note

The note about event pattern figures in the delegate section but does not have anything to do with delegates. It was clearly misplaced and should have been placed in the events section which is a few pages further.

Romain LHOTTE  Jul 10, 2024 
PDF Page Page no. 78 or 89 - Raw string literals (C# 11)
Last code snippet

Multiline raw string has an extra \r\n at the beginning & end when compared to single quote string above it.

Bhavesh Mirani  Jun 25, 2024 
PDF Page p. 585
In code under "Anonymous Disposal" title.

Inside the "class Foo" here is mentioned that "int _suspendCount;". Which in C# mean that "_suspendCount" field is "private", but in the next page inside "class SuspendToken" with the object of "class Foo" by the name "_foo" mentioned call of this private field:

if (_foo != null) _foo._suspendCount--;

It can happen only when "class SuspendToken" is nested for "class Foo"... which is not apparent from text.

Thank you.

Suren Edilyan  Mar 03, 2024 
Other Digital Version Chapter 2 "Compilation"
dotnet new Console -n MyFirstProgram

The code to create the first project folder and file has a small typo. This line of code: dotnet new Console -n MyFirstProgram
should be changed to: dotnet new console -n MyFirstProgram
On my Windows 11 pc the template Console App is created with a lowercase 'c' rather than capital 'C'.

Here is a log of my PowerShell session:

PS C:\Projects> dotnet new Console -n MyFirstProgram
No templates or subcommands found matching: 'Console'.
Did you mean one of the following templates?
dotnet new console

To list installed templates similar to 'Console', run:
dotnet new list Console
To search for the templates on NuGet, run:
dotnet new search Console


For details on the exit code, refer to <url-hidden>
PS C:\Projects> dotnet new console -n MyFirstProgram
The template "Console App" was created successfully.

Processing post-creation actions...
Restoring C:\Projects\MyFirstProgram\MyFirstProgram.csproj:
Determining projects to restore...
Restored C:\Projects\MyFirstProgram\MyFirstProgram.csproj (in 94 ms).
Restore succeeded.



Anonymous  Dec 25, 2023 
Other Digital Version 119
Section "Ranges", 2nd paragraph

Using the Kindle version of the book.

You state that the 2nd number in the range is exclusive, but don't mention that the first number in the range is inclusive. That, coupled with the example using "2", caused confusion for me as I incorrectly assumed you were saying that the numbers in the range are exclusive. I puzzled over the results of your example for a long time until I looked up the Microsoft Learn tutorial article "Explore indexes and ranges", which explains that "A range specifies the start and end of a range. The start of the range is inclusive, but the end of the range is exclusive, meaning the start is included in the range but the end isn't included in the range."

Bryan H. Bell  Dec 10, 2023