Visual Studio 2010 How to replace large string variable with new XML while debugging
I am using Visual Studio 2010 and have a breakpoint set to stop execution of the app after a variable is set with contents of a large XML string. I want to replace the contents of the string with a different XML string. I open the Text Visualizer but it does not allow me to modify the string. How can I change the content开发者_运维知识库s of the variable? I have the variable displayed in a Watch Window but only the first line of the string is copied.
My workaround for this:
Copy the text from Text Visualizer to notepad:
<table xmlns="http://www.w3schools.com/furniture"> <name>African Coffee Table</name> <width>80</width> <length>120</length> </table>
Edit the value according your needs:
<table xmlns="http://www.w3schools.com/furniture"> <name>African Coffee Table</name> <width>100</width> <length>200</length> <weight m="kilo">12</weight> </table>
Replace all
"
with""
:<table xmlns=""http://www.w3schools.com/furniture""> <name>African Coffee Table</name> <width>100</width> <length>200</length> <weight m=""kilo"">12</weight> </table>
- Open Immediate Window
Assign the new value to the variable using verbatim string literal
@""
, e.g.myXml=@"<table xmlns=""http://www.w3schools.com/furniture""> <name>African Coffee Table</name> <width>100</width> <length>200</length> <weight m=""kilo"">12</weight> </table>"
精彩评论