diff --git a/docs/errata/errata.md b/docs/errata/errata.md index 3969f13..3dd6ac5 100644 --- a/docs/errata/errata.md +++ b/docs/errata/errata.md @@ -3,6 +3,7 @@ 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. - [Page n - Understanding the journey to one .NET and Understanding .NET support](#page-n---understanding-the-journey-to-one-net-and-understanding-net-support) +- [Page n - Formatting using numbered positional arguments](#page-n---formatting-using-numbered-positional-arguments) - [Page n - Running unit tests using Visual Studio Code](#page-n---running-unit-tests-using-visual-studio-code) # Page n - Understanding the journey to one .NET and Understanding .NET support @@ -17,6 +18,38 @@ On October 28, 2022, the .NET team changed the name *again*, to [**Standard Term *Sigh.* Such are the perils of trying to be up-to-date on release day. +# Page n - Formatting using numbered positional arguments + +At the end of the section, I say, "The `Write`, `WriteLine`, and `Format` methods can have up to four numbered arguments, named `arg0`, +`arg1`, `arg2`, and `arg3`. If you need to pass more than four values, then you cannot name them, as shown in the following code:" + +```cs +// Four parameter values can use named arguments. +Console.WriteLine( + format: "{0} {1} lived in {2}, {3}.", + arg0: "Roger", arg1: "Cevung", + arg2: "Stockholm", arg3: "Sweden"); + +// Five or more parameter values cannot use named arguments. +Console.WriteLine( + format: "{0} {1} lived in {2}, {3} and worked in the {4} team at {5}.", + "Roger", "Cevung", "Stockholm", "Sweden", "Education", "Optimizely"); +``` + +But the methods can only have up to *three* named arguments. I should have said, "The `Write`, `WriteLine`, and `Format` methods can have up to three numbered arguments, named `arg0`, `arg1`, and `arg2`. If you need to pass more than three values, then you cannot name them, as shown in the following code:" + +```cs +// Three parameter values can use named arguments. +Console.WriteLine( + format: "{0} {1} lived in {2}.", + arg0: "Roger", arg1: "Cevung", arg2: "Stockholm"); + +// Four or more parameter values cannot use named arguments. +Console.WriteLine( + "{0} {1} lived in {2} and worked in the {3} team at {4}.", + "Roger", "Cevung", "Stockholm", "Education", "Optimizely"); +``` + # Page n - Running unit tests using Visual Studio Code > Thanks to [kwatsonkairosmgt](https://github.com/kwatsonkairosmgt) for raising this [issue on 27 October 2022](https://github.com/markjprice/cs10dotnet6/issues/106).