diff --git a/Errata.md b/Errata.md index 1838f250..1ac5ef24 100644 --- a/Errata.md +++ b/Errata.md @@ -33,4 +33,5 @@ Zhou Jing | 20 | 1018 | Change paragraph beginning with "The need to support TAP Zhou Jing | 18 | 911 | Change CommandLineRequiredAttribute to CommandLineSwitchRequiredAttribute Zhou Jing | 18 | 902-903 | Change CommandLineAliasAttribute to CommandLineSwitchAliasAttribute Zhou Jing | 23 | 1105 | Change `Length = 10` in listing 23.20 to `Length = 12` to show entire output message -Zhou Jing | 18 | 926-927 | Change 'LastName' references to be 'FirstName' in paragraphs \ No newline at end of file +Zhou Jing | 18 | 926-927 | Change 'LastName' references to be 'FirstName' in paragraphs +Jinhang He | 5 | 255 | Edit listing 5.20 to used `image[index]` for the second print statement \ No newline at end of file diff --git a/src/Chapter05.Tests/Listing05.20.ReturningAReference.Tests.cs b/src/Chapter05.Tests/Listing05.20.ReturningAReference.Tests.cs index fde86650..d7444761 100644 --- a/src/Chapter05.Tests/Listing05.20.ReturningAReference.Tests.cs +++ b/src/Chapter05.Tests/Listing05.20.ReturningAReference.Tests.cs @@ -8,12 +8,9 @@ public class ProgramTests public void Main_InputInigoMontoya_WriteFullName() { string expected = @"image\[*\]=Red -image\[*\]=Black"; +image\[*\]=Yellow"; - IntelliTect.TestTools.Console.ConsoleAssert.ExpectLike(expected, - () => - { - Program.Main(); - }); + IntelliTect.TestTools.Console.ConsoleAssert.ExpectLike(expected, + () => Program.Main()); } } diff --git a/src/Chapter05/Listing05.20.ReturningAReference.cs b/src/Chapter05/Listing05.20.ReturningAReference.cs index 3ce0b09b..8e5d6f47 100644 --- a/src/Chapter05/Listing05.20.ReturningAReference.cs +++ b/src/Chapter05/Listing05.20.ReturningAReference.cs @@ -32,11 +32,11 @@ public static void Main() #region HIGHLIGHT // Obtain a reference to the first red pixel ref byte redPixel = ref FindFirstRedEyePixel(image); - // Update it to be Black - redPixel = (byte)ConsoleColor.Black; + // Update it to be Yellow + redPixel = (byte)ConsoleColor.Yellow; #endregion HIGHLIGHT Console.WriteLine( - $"image[{index}]={(ConsoleColor)image[redPixel]}"); + $"image[{index}]={(ConsoleColor)image[index]}"); } #endregion INCLUDE }