Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

debugging - Copy value of watch variable in visual studio without escape characters

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 '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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...