visual-studio “这个表达式会导致副作用,不会被评估”。怎么压制?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4178647/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:45:37  来源:igfitidea点击:

"This expression causes side effects and will not be evaluated". How to suppress?

c#visual-studio-2010visual-studio

提问by fithu

I'm getting this message in watch box.
Actually, my expression doesn't have any side effect, and I need to re-evaluate it automatically each time. How can I achieve that?

我在手表盒中收到此消息。
实际上,我的表达式没有任何副作用,每次都需要自动重新评估。我怎样才能做到这一点?

回答by zproxy

You can append ",ac" to the watch expression to have it automatically refresh the value

您可以将“,ac”附加到监视表达式以使其自动刷新值

x.ToString(),ac

x.ToString(),ac

See http://msdn.microsoft.com/en-us/library/e514eeby.aspxfor more information and other format specifiers.

有关详细信息和其他格式说明符,请参阅http://msdn.microsoft.com/en-us/library/e514eeby.aspx

thanks to Scott Visual Studio: Make debugger aware that a function doesn't cause "side effects"

感谢 Scott Visual Studio:让调试器意识到函数不会导致“副作用”