From c1eb8911169e59cbabb000ff3e7bfcba8bed0b4c Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Wed, 19 Feb 2025 20:23:27 -0800 Subject: [PATCH] fix: Add line breaks inside brackets in interpolated string Fixes #617 --- Errata.md | 3 ++- .../Listing02.16.NewLinesWithinStringInterpolation.cs | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Errata.md b/Errata.md index 70d7e66ec..4e756de43 100644 --- a/Errata.md +++ b/Errata.md @@ -40,6 +40,7 @@ Zhou Jing | 23 | 1080 | Change "DWORD flProtect); // The type of memory allocati Zhou Jing | 22 | 1065 - 1066 | Changed 'Thread' to 'Task' and "Application exiting" to "Application shutting down" Zhou Jing | 4 | 161 | Fix `input < 9` to `input < 0` in Listing 4.24 Zhou Jing | 4 | 119 | Show inconsistent size multi-dimensional array in listing 3.16 -Zhou Jing | 3 | 114 | Replace `second` with `third` in "// Retrieve third item from the end (Python)" +Zhou Jing | 3 | 114 | Replace `second` with `third` in "// Retrieve third item from the end (Python)" Tyler Woody | 13 | 702 | Remove the `!` negation in `string.IsNullOrWhiteSpace(input)` in the while loop to properly allow looping Benjamin Michaelis | 19 | 948-949 | Add a `(` before the `next + 1` to complete the parenthesis. +Zhou Jing | 2 | 70 | Add breaks inside the brackets in the string interpolation in listing 2.16 \ No newline at end of file diff --git a/src/Chapter02/Listing02.16.NewLinesWithinStringInterpolation.cs b/src/Chapter02/Listing02.16.NewLinesWithinStringInterpolation.cs index 2cc97f85d..c1015a451 100644 --- a/src/Chapter02/Listing02.16.NewLinesWithinStringInterpolation.cs +++ b/src/Chapter02/Listing02.16.NewLinesWithinStringInterpolation.cs @@ -14,7 +14,11 @@ public static void Main() lastName = Console.ReadLine(); #region INCLUDE - Console.WriteLine($@"Your full name is: {firstName} {lastName}"); + Console.WriteLine($"Your full name is: { + firstName + + " " + + lastName + }"); #endregion INCLUDE } } \ No newline at end of file