How to include quotes in a string
I have a string "I want to learn "c#"". How can I include the quotes before and after c#?
Escape them with backslashes.
"I want to learn \"C#\""
As well as escaping quotes with backslashes, also see SO question 2911073 which explains how you could alternatively use double-quoting in a @-prefixed string:
string msg = @"I want to learn ""c#""";
I use:
var value = "'Field1','Field2','Field3'".Replace("'", "\"");
as opposed to the equivalent
var value = "\"Field1\",\"Field2\",\"Field3\"";
Because the former has far less noise than the latter, making it easier to see typo's etc.
I use it a lot in unit tests.
string str = @"""Hi, "" I am programmer";
OUTPUT - "Hi, " I am programmer