From d0797084e9df0a7b4f749bec3905f548eddfc250 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Mon, 27 Jan 2025 09:19:29 -0500 Subject: [PATCH] Add rule for the closing newline on raw string literals Replaces #44534, which targeted the wrong branch. (@gewarren Not sure why our rules didn't prevent it from being merged). Addresses anonymous feedback. Add a rule that the final newline before the closing quote characters is ignored --- docs/csharp/language-reference/tokens/raw-string.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/csharp/language-reference/tokens/raw-string.md b/docs/csharp/language-reference/tokens/raw-string.md index 726bf6e6aa888..2e1077572fe1e 100644 --- a/docs/csharp/language-reference/tokens/raw-string.md +++ b/docs/csharp/language-reference/tokens/raw-string.md @@ -22,6 +22,7 @@ The following rules govern the interpretation of a multi-line raw string literal - Whitespace following the opening quote on the same line is ignored. - Whitespace only lines following the opening quote are included in the string literal. - If a whitespace precedes the end delimiter on the same line, the exact number and kind of whitespace characters (e.g. spaces vs. tabs) must exist at the beginning of each content line. Specifically, a space does not match a horizontal tab, and vice versa. +- The newline before the closing quotes isn't included in the literal string. You may need to create a raw string literal that has three or more consecutive double-quote characters. Raw string literals can start and end with a sequence of at least three double-quote characters. When your string literal contains three consecutive double-quotes, you start and end the raw string literal with four double quote characters: