Add item for page 91

This commit is contained in:
Mark J Price 2023-05-10 09:45:47 +01:00
parent 202573e2b6
commit 275961e5c5
3 changed files with 19 additions and 2 deletions

View file

@ -4,7 +4,7 @@ If you find any mistakes in the seventh edition, *C# 11 and .NET 7 - Modern Cros
[**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** (33 items)](improvements.md): Changes to text or code that would improve the content. These are optional.
[**Improvements** (34 items)](improvements.md): Changes to text or code that would improve the content. These are optional.
[**Common Errors** (4 items)](common-errors.md): These are some of the most common errors that a reader might encounter when trying to get code in book tasks to work, or when trying to write your own code.

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 KiB

View file

@ -1,4 +1,4 @@
**Improvements** (33 items)
**Improvements** (34 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.
@ -98,6 +98,23 @@ In Step 1, I note that the `ReadLine` method is declared to return `string?`, me
In the next edition, I will add a note to explain that this method never actually returns `null` so there is no point in checking for that in functional code. A more useful check is `string.IsNullOrEmpty` so I will add more steps to show how to use that method and `string.IsNullOrWhiteSpace` to validate text input.
# Page 91 - Passing arguments to a console app
> Thanks to `MINIMA#8536` for raising this issue in the Discord channel for this book.
I give instructions for Visual Studio 2022 for Windows and Visual Studio Code. A few readers use Visual Studio 2022 for Mac but it is different to Visual Studio 2022 for Windows.
In the next edition, I will add steps for Visual Studio 2022 for Mac:
1. In Visual Studio for Mac, right-click the `Arguments` project.
2. In the popup menu, select **Properties**.
3. In the **Project Properties - Arguments** dialog box, in the left-hand navigation section, select **Run** | **Configurations** | **Default**.
4. In the **Arguments** box, enter the arguments: `firstarg second-arg third:arg "fourth arg"`, as shown in the following screenshot.
5. Click **OK**.
6. Run the console app.
![Passing arguments using Visual Studio 2022 for Mac](images/vsmac-arguments.png)
# Page 128 - Rounding numbers
In this section, I wrote about rounding rules as taught in schools and compare them to rounding rules when using C# and .NET. In schools, children are introduced to rounding rules with positive numbers and so learn the term "rounding up" and "rounding down". I did not explicitly say that for negative numbers, those terms would be reversed which can be confusing, so those terms should be avoided. This is why the .NET API uses the enum values `AwayFromZero`, `ToZero`, `ToEven`, `ToPositiveInfinity` and `ToNegativeInfinity` for improved clarity. In the next edition I will add a note about this.