I'm trying to do something very simple.
string img = "sadadsasdsa";
string res = @"<image src=""data:img/jpg;base64," + img + @"""/>";
I get the output as <image src=\"data:img/jpg;base64,sadadsasdsa\"/>
While the output that I want is <image src="data:img/jpg;base64,sadadsasdsa"/>
I don't want the unexpected '\' to be added before data and at the end.
I even tried using the backslash as the escape sequence as
string res = "<image src=\"data:img/jpg;base64," + img + "\"/>";
I still get the same output. What am I missing here?
Okay, when I print the above 'res' string using console.writeline, I'm not getting the magical slash. But when I view it in debugger, I do see it. And I still see it when I return the string from a web API values controller. I guess this has to do with parsing of the string literal
[HttpGet]
[Route("api/quotes/image")]
public string ImageString()
{
string imgg = "sadadsasdsa" + "\"";
string ress = @"<image src=""data:img/jpg;base64," + imgg + "/>";
return ress;
}
When I try to print the string using Console.WriteLine, I don't see the unwanted backslash. But I do see it in the debugger and when returning the string from the WebAPI controller as above.