double-quotes

How to add double quotes to a string that is inside a variable?

天涯浪子 提交于 2019-11-25 21:15:31
I have variable like: string title = string.empty; My need is that whatever string is passed to it I have to display the content inside a div with in a double quotes. So I have written something like: ... ... <div>"+ title +@"</div> ... ... But how to add the double quotes here? So that it will display like : "How to add double quotes" You need to escape them by doubling them (verbatim string literal): string str = @"""How to add doublequotes"""; Or with a normal string literal you escape them with a \ : string str = "\"How to add doublequotes\""; So you are essentially asking how to store