raw string vs verbatin string [Answered]
what is the difference between
@"
and """
16 Replies
"""
ignores the whitespace that comes before the start of the string on each line so that you can make string literals more readable. It also make it easier to but " characters in the string, as you need a sequence of three to close it.
with a verbatim string you would do something like this(That isn't a correct example)
with a raw string you could do this
You need to escape the
"
soops
Still wrong.
""
is how you escape quotes in verbatim strings
The idea with raw strings is that, no matter text input you have, you will be able to copy/paste it directly into the string contenti dont write enough raw literals apparently
Is how you write that one
ya, never used verbatim strings before
I think you might be confusing which is which
@"
is verbatim
"""
is rawis it?
Yes
dammit
Anyway, to answer the question @AndroidUI: raw strings are a new feature we made to address some of the shortcomings and annoyances with verbatim strings. I'll still probably use verbatim strings for single-line content, but mutli-line I'm pretty much always going to be using raw from now on
Remember, though, it's not quite out yet: November is C# 11 release
🙂
✅ This post has been marked as answered!