Bird
Raised Fist0

Which of the following is the correct syntax for a raw string literal in C# 11+?

easy📝 Syntax Q12 of Q15
C Sharp (C#) - Strings and StringBuilder
Which of the following is the correct syntax for a raw string literal in C# 11+?
A"""This is a raw string"""
B@"This is a raw string"
C'This is a raw string'
D"This is a raw string"
Step-by-Step Solution
Solution:
  1. Step 1: Recall raw string literal syntax

    Raw string literals in C# 11+ use triple double quotes to start and end the string.
  2. Step 2: Compare options

    """This is a raw string""" uses triple double quotes correctly; @"This is a raw string" is verbatim string syntax, not raw string.
  3. Final Answer:

    """This is a raw string""" -> Option A
  4. Quick Check:

    Raw strings use triple quotes = D [OK]
Quick Trick: Raw strings use triple quotes """ at start and end [OK]
Common Mistakes:
MISTAKES
  • Confusing verbatim strings (@) with raw strings (""")
  • Using single quotes for strings
  • Using normal double quotes for raw strings

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Sharp (C#) Quizzes