停止 Visual Studio 调试在包含双引号的字符串中放置斜杠 [英] Stop visual studio debug putting slash in string containing double quotes

查看:32
本文介绍了停止 Visual Studio 调试在包含双引号的字符串中放置斜杠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我昨天在 Visual Studio 2015 中遇到了这种奇怪的行为,我正在制作一个以双引号开头和结尾的字符串.在逐步执行代码时,我将鼠标悬停在结果上以查看内容,并且字符串中有反斜杠 - 什么!(见下图).长话短说,我发现变量的调试视图显示带有转义的反斜杠 - 在我看来这是一种误导.

I hit this odd behavour yesterday in Visual Studio 2015 where I was making a string that started and ended with double quotes. In stepping through the code I hovered over the result to see the contents and there were back slashes in the string - what! (see image below). Cutting a long story short, I figured out the debug view of the variable is displaying with the escaping backslashes - which in my opinion is misleading.

有谁知道是否有办法在 Visual Studio 中禁用它,以便它仅将值显示为 ""bob*"" 或不指示字符串类型 鲍勃*" ?

Does any one know if there is a way to disable this in Visual Studio so that it just displays the value as either ""bob*"" or without indication of the string type "bob*" ?

附言是的,我知道,在注意到这种行为之前使用 VS 多年似乎有点新手.图像也没有显示我们的生产代码 :)

P.S. Yes I know, it seems a bit newbie to be using VS for years before noticing this behavour. Also the image is not showing our production code :)

推荐答案

这是意料之中的.因为您处于调试模式,所以您将获得字符串的开发版本.

This is expected. Because you are under debug mode you are given the dev version of the string.

要获得用户友好版本的字符串(不带斜杠的实际值),您只需单击左侧的放大镜图标

To get a user friendly version of the string (actual value without slash) you just have to click on the magnify glass icon on the left

这篇关于停止 Visual Studio 调试在包含双引号的字符串中放置斜杠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆