Copy value of watch variable in visual studio without escape characters

后端 未结 3 1840
太阳男子
太阳男子 2020-12-13 13:05

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
F         


        
相关标签:
3条回答
  • 2020-12-13 13:20

    Use the "text visualizer" popup on the value and copy it to the clipboard from there. It will be unescaped.

    0 讨论(0)
  • 2020-12-13 13:21

    For lengthy text, such as a large xml document, I always use the immediate window. Just type this in and hit enter:

    System.Diagnostics.Debug.WriteLine(szSql)

    and it will spit out the text with line breaks and without escape characters. I then copy from the immediate window.

    0 讨论(0)
  • 2020-12-13 13:36

    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.

    0 讨论(0)
提交回复
热议问题