mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2026-01-09 01:30:32 +01:00
Add errata for page 85
This commit is contained in:
parent
9d832c7498
commit
e6db791c23
|
|
@ -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** (9 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build.
|
||||
[**Errata** (10 items)](errata.md): Typos, tool user interface changes, or mistakes in code that would cause a compilation error that prevents a successful build.
|
||||
|
||||
[**Improvements** (1 item)](improvements.md): Changes to text or code that would improve the content. These are optional.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
**Errata** (9 items)
|
||||
**Errata** (10 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.
|
||||
|
||||
|
|
@ -8,6 +8,7 @@ If you find any mistakes, then please [raise an issue in this repository](https:
|
|||
- [Page 11 - Understanding the journey to one .NET and Understanding .NET support](#page-11---understanding-the-journey-to-one-net-and-understanding-net-support)
|
||||
- [Page 37 - Getting definitions of types and their members](#page-37---getting-definitions-of-types-and-their-members)
|
||||
- [Page 83 - Formatting using numbered positional arguments](#page-83---formatting-using-numbered-positional-arguments)
|
||||
- [Page 85 - Getting text input from the user](#page-85---getting-text-input-from-the-user)
|
||||
- [Page 86 - Getting text input from the user](#page-86---getting-text-input-from-the-user)
|
||||
- [Page 185 - Creating a class library that needs testing](#page-185---creating-a-class-library-that-needs-testing)
|
||||
- [Page 188 - Running unit tests using Visual Studio Code](#page-188---running-unit-tests-using-visual-studio-code)
|
||||
|
|
@ -21,6 +22,8 @@ The **.NET Interactive Notebooks** extension has been renamed to **Polyglot Note
|
|||
|
||||
> Read more here: https://devblogs.microsoft.com/dotnet/dotnet-interactive-notebooks-is-now-polyglot-notebooks/#why-the-name-change
|
||||
|
||||
I wrote that "They cannot read input from the user, for example, you cannot use ReadLine or ReadKey." Although you cannot use the `Console` class methods, you can use the `Microsoft.DotNet.Interactive.Kernel` class and its `GetInputAsync` method. This uses the Visual Studio Code user interface to prompt the user for input.
|
||||
|
||||
# Page 11 - Understanding the journey to one .NET and Understanding .NET support
|
||||
|
||||
Even-numbered .NET releases like .NET 6 and .NET 8 have a support level named **Long Term Support (LTS)** with a duration of 3 years. Odd-numbered .NET releases like .NET 5 and .NET 7 had a support level named **Current** with a duration of 18 months.
|
||||
|
|
@ -76,6 +79,22 @@ Console.WriteLine(
|
|||
"Roger", "Cevung", "Stockholm", "Education", "Optimizely");
|
||||
```
|
||||
|
||||
# Page 85 - Getting text input from the user
|
||||
|
||||
I wrote that a notebook "does not support reading input from the console using `Console.ReadLine()`." Although this is true, you can use the `Microsoft.DotNet.Interactive.Kernel` class and its `GetInputAsync` method instead. This uses the .NET Interactive integration with the Visual Studio Code user interface to prompt the user for input.
|
||||
|
||||
```cs
|
||||
using Microsoft.DotNet.Interactive; // to use the Kernel class
|
||||
|
||||
string firstName = await Kernel.GetInputAsync("Type your first name: ");
|
||||
|
||||
string age = await Kernel.GetInputAsync("Type your age: ");
|
||||
|
||||
Console.WriteLine($"Hello {firstName}, you look good for {age}.");
|
||||
```
|
||||
|
||||

|
||||
|
||||
# Page 86 - Getting text input from the user
|
||||
|
||||
In Step 3, I wrote, "For the `firstName` variable" when I should have written, "For the `age` variable".
|
||||
|
|
|
|||
BIN
docs/errata/images/kernel-getinputasync.png
Normal file
BIN
docs/errata/images/kernel-getinputasync.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 134 KiB |
Loading…
Reference in a new issue