From 0a631d2b4c7b97f394dc52233427c70ec3020bac Mon Sep 17 00:00:00 2001 From: Mark J Price Date: Sun, 5 Mar 2023 18:19:42 +0000 Subject: [PATCH] Add item for page 237 --- docs/errata/README.md | 2 +- docs/errata/improvements.md | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/errata/README.md b/docs/errata/README.md index 43a09b4..2a7cbf0 100644 --- a/docs/errata/README.md +++ b/docs/errata/README.md @@ -4,6 +4,6 @@ If you find any mistakes in the seventh edition, *C# 11 and .NET 7 - Modern Cros [**Errata** (31 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build. -[**Improvements** (14 items)](improvements.md): Changes to text or code that would improve the content. These are optional. +[**Improvements** (15 items)](improvements.md): Changes to text or code that would improve the content. These are optional. All errata and improvements will be included in the 8th edition planned for publishing in November 2023. To be included they must be submitted by mid-September 2023. diff --git a/docs/errata/improvements.md b/docs/errata/improvements.md index 56ae13b..1ae05a5 100644 --- a/docs/errata/improvements.md +++ b/docs/errata/improvements.md @@ -1,4 +1,4 @@ -**Improvements** (14 items) +**Improvements** (15 items) 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. @@ -6,6 +6,7 @@ If you have suggestions for improvements, then please [raise an issue in this re - [Page 128 - Rounding numbers](#page-128---rounding-numbers) - [Page 153 - Writing a function that returns a value](#page-153---writing-a-function-that-returns-a-value) - [Page 179 - Reviewing project packages](#page-179---reviewing-project-packages) +- [Page 237 - Implementing functionality using methods](#page-237---implementing-functionality-using-methods) - [Page 251 - Setting up a class library and console application](#page-251---setting-up-a-class-library-and-console-application) - [Page 299 - Treating warnings as errors](#page-299---treating-warnings-as-errors) - [Page 453 - Scaffolding models using an existing database](#page-453---scaffolding-models-using-an-existing-database) @@ -69,6 +70,20 @@ Due to transitive dependencies, you only actually need to explicitly reference t ``` +# Page 237 - Implementing functionality using methods + +In Step 4, I tell the reader to write some code that uses the `??` operator. But I do not explain how this operator works until later in the book, on page 282, as shown in the following text and code example: + +"Sometimes, you want to either assign a variable to a result or use an alternative value, such as `3`, if the +variable is `null`. You do this using the **null-coalescing operator**, `??`, as shown in the following code: +```cs +// result will be 3 if authorName?.Length is null +int result = authorName?.Length ?? 3; +Console.WriteLine(result); +``` + +In the 8th edition, I will add a similar explanation of the operator `??` to the **Chapter 3, Operating on variables** section. + # Page 251 - Setting up a class library and console application In Step 8, I wrote, "Run the `PeopleApp` project".