Why does C# require doubling quotes inside verbatim and raw string literals instead of using backslash escapes?
hard🧠 Conceptual Q10 of 15
C Sharp (C#) - Strings and StringBuilder
Why does C# require doubling quotes inside verbatim and raw string literals instead of using backslash escapes?
ATo allow embedding of code inside strings without errors.
BBecause backslash is not a valid escape character in C# strings.
CTo keep the string syntax simple and avoid confusion with escape sequences.
DBecause doubling quotes is faster to process at runtime.
Step-by-Step Solution
Solution:
Step 1: Understand design choice for string literals
C# uses doubling quotes to clearly distinguish literal quotes inside strings without mixing escape sequences.
Step 2: Evaluate options
To keep the string syntax simple and avoid confusion with escape sequences. correctly explains the reason is to keep syntax simple and avoid confusion.
Final Answer:
To keep the string syntax simple and avoid confusion with escape sequences. -> Option C