Ok, this one has been driving me bonkers for ages and VS 2010 hasn't improved this. Say I have a variable like so
string szSql = @"SELECT Foo, Bar FROM Table WHERE Foo = Bar";
If I'm inspecting this in the debugger and choose "Copy Value" the value put into the clipboard has \r\n's in place of the carriage returns which is a bit of a pain. Is there a way to change this behaviour? (I know I can print it in the command window...)
Cheers,
Alex
Hover over a variable to see its value. When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable. If the variable is an object, you can expand the object by clicking on the arrow to see the elements of that object.
Right-click on a variable choose "Add Watch" in the context menu. Right-click on a variable in the DataTip and choose "Add Watch" "Add Watch" button from QuickWatch.
We open that window with the Shift + F9 key combination or with the 'QuickWatch' option from the right-click menu in the code editor. What 'QuickWatch' does is show us what the value of an expression or variable is at the current, paused state of the program.
Append ,nq
(short for no quotes) to the variable name in the watch window and it will display the string without escape characters, which you could then copy. For reference the MSDN document is here.
Use the "text visualizer" popup on the value and copy it to the clipboard from there. It will be unescaped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With