Add item for page 237

This commit is contained in:
Mark J Price 2023-03-05 18:19:42 +00:00
parent af1d5e42b7
commit 0a631d2b4c
2 changed files with 17 additions and 2 deletions

View file

@ -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.

View file

@ -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
</ItemGroup>
```
# 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".