In C++, we have raw literal string using R"()"
with delimiter. So this code below is fine:
const char SOMETEXT[] = R"+-+-+(<link rel="icon" href="img/favicon.png">)+-+-+"
I don't know how to do it in C#, as far as I know there is a verbatim string using @""
but it doesn't have delimiter. And this causes error:
string SOMETEXT = @"<link rel="icon" href="img/favicon.png">";
Is there any raw literal string with delimiter in C#? Because I don't want to change the string, it will PITA to edit later.
No, there's nothing like this in C#. If this is arbitrary text that you'll need to edit reasonably frequently, you might want to put it into a resource file instead.
Another alternative I often use for JSON that appears in tests etc is to just use single quotes instead of double quotes, then replace afterwards:
string text = "<link rel='icon' href='img/favicon.png'>".Replace('\'', '"');