1

I have a situation where I'm storing some XML into a string like so:

string searchXML = @"<Search order=""name""><Group conditions_operand=""all""><Condition model=""Company""><Attribute>id</Attribute><Operator>equals</Operator><Values><Value>" + variablenamehere + "</Value></Values></Condition></Group></Search>";

and I've noticed that it's storing this into the string with several escape characters included, for example if i inspect the string I see:

<Search order=\"name\"><Group conditions_operand=\"all\">

Is it actually storing the \ character in there? If so how can I get rid of it as I do not think this is properly formatted XML. I am using double quotes in the first place because I need to do that as an escape sequence.

1 Answer 1

4

No, it's not storing the escape characters. That's just the way the debugger displays the string. If you type searchXML in the Immediate Window in Visual Studio, it should print out without the escape characters.

Sign up to request clarification or add additional context in comments.

2 Comments

this is interesting, i checked the immediate window and still see <Search order=\"name\"><Group conditions_operand=\"all\"><Condition model=\"Company\"><Attribute>id</Attribute><Operator>equals</Operator><Values><Value>0000000015</Value></Values></Condition></Group></Search>"
@testercoder1 interesting. You're right. Either way it's not storing the escape characters, it's just a debugger display thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.