string value = "SELECT dbo.GetDefaultType(\"PartnerType\") AS default_answer;"
How can i remove "\" from the above string.
Get the ref from here and tried,
value.Replace(@"\", "");
value.Replace(@"\", string.Empty);
string value = "SELECT dbo.GetDefaultType(\"PartnerType\") AS default_answer;"
How can i remove "\" from the above string.
Get the ref from here and tried,
value.Replace(@"\", "");
value.Replace(@"\", string.Empty);
The \
isn't actually in the string it is only there to stop the double quotes from terminating the string literal early.
The string actually is SELECT dbo.GetDefaultType("PartnerType") AS default_answer;
value
could just as easily been declared as
string value = @"SELECT dbo.GetDefaultType(""PartnerType"") AS default_answer;"
Where ""
inside the string is still only a single quote "
I'm pretty sure that you just see the value in the debugger and it shows the \
from the string literal. If you click at the loupe you would see the real string value which is:
SELECT dbo.GetDefaultType("PartnerType") AS default_answer;
But to answer the question, if the string really was(including the declaration)
string value = "SELECT dbo.GetDefaultType(\"PartnerType\") AS default_answer;"
Then it could be initalized with this literal:
string value = "string value = \"SELECT dbo.GetDefaultType(\\\"PartnerType\\\") AS default_answer;\"";
and you could really remove the backslashes with:
value = value.Replace("\\", "");