This is very simple thing, but as I am new to C# I would like to know, how can I add double quotes ("Hello " this is string") in string in C# programming.
You can simply escape the double quotes using extra "
var str1 = @"""String Inside quotes""";
var str2 = "\"Second string Inside quotes\"";
Console.WriteLine(str1);
Console.WriteLine(str2);
Output:
"String Inside quotes"
"Second string Inside quotes"
OR
To make it look simpler
var str1 = @"String ""inside"" Then After";
That should work, thanks.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly