From 05ec405f3b65ab3e3f516340dfb43c4e41883758 Mon Sep 17 00:00:00 2001 From: Mark J Price Date: Sat, 29 Apr 2023 10:11:05 +0100 Subject: [PATCH] Add item for page 256 --- docs/errata/README.md | 2 +- docs/errata/errata.md | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/errata/README.md b/docs/errata/README.md index 8140bcd..a628213 100644 --- a/docs/errata/README.md +++ b/docs/errata/README.md @@ -2,7 +2,7 @@ If you find any mistakes in the seventh edition, *C# 11 and .NET 7 - Modern Cross-Platform Development Fundamentals*, or if you have suggestions for improvements, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com. -[**Errata** (43 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build. +[**Errata** (44 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build. [**Improvements** (31 items)](improvements.md): Changes to text or code that would improve the content. These are optional. diff --git a/docs/errata/errata.md b/docs/errata/errata.md index 205c456..6ccf3a2 100644 --- a/docs/errata/errata.md +++ b/docs/errata/errata.md @@ -1,4 +1,4 @@ -**Errata** (43 items) +**Errata** (44 items) If you find any mistakes, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com. @@ -24,6 +24,7 @@ If you find any mistakes, then please [raise an issue in this repository](https: - [Page 231 - Requiring properties to be set during instantiation](#page-231---requiring-properties-to-be-set-during-instantiation) - [Page 235 - More about methods](#page-235---more-about-methods) - [Page 244 - Init-only properties](#page-244---init-only-properties) +- [Page 256 - Defining and handling delegates](#page-256---defining-and-handling-delegates) - [Page 258 - Defining and handling events](#page-258---defining-and-handling-events) - [Page 263 - Comparing objects using a separate class](#page-263---comparing-objects-using-a-separate-class) - [Page 272 - Defining struct types](#page-272---defining-struct-types) @@ -354,6 +355,19 @@ cgwid suggested a solution in [the issue they raised](https://github.com/markjpr In Step 1, I say to add a new file named `Records.cs` to the `PacktLibraryNetStandard2` project/folder. I should have said to the `PacktLibraryModern` project/folder. +# Page 256 - Defining and handling delegates + +> Thanks to **bfdhud**` for raising this issue via Discord. + + +In Step 2, if you use Visual Studio 2022 to create the class file then it will have multiple statements of existing code. These statements should be deletd and replaced with the code as shown in Step 3. If you just add new statements inside those created by Visual Studio 2022 then it won't work because the `partial Program` class needs to be in the default empty namespace just like the auto-generated `Program` class is. + +A similar issue is covered by these improvement items: +https://github.com/markjprice/cs11dotnet7/blob/main/docs/errata/improvements.md#page-149---writing-a-times-table-function +https://github.com/markjprice/cs11dotnet7/blob/main/docs/errata/improvements.md#page-241---defining-flight-passengers + +In the next edition I will add notes to warn Visual Studio 2022 users to delete any existing statements. + # Page 258 - Defining and handling events > Thanks to [Ricky](https://github.com/r1c5) for raising this [issue on 2 February 2023](https://github.com/markjprice/cs11dotnet7/issues/23).