If you are adding strings in code, i.e. something like:
string s = “abc” + “def”
Then the escape character is a \ i.e.
String s = “abc\"def \r\n and so on"
If you want to output a string inside the value of a property of an html attribute, i.e. something like:
And the variable potentially contains special characters that can’t be put in an attribute, then you want this: