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

查看:156
本文介绍了停止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 * 或不指示字符串类型 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*" ?

PS是的,我知道,在注意到这种行为之前使用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 :)

推荐答案

这是预期的。因为您处于调试模式,所以将获得字符串的dev版本。

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天全站免登陆