在休息条件下进行分配 [英] Doing assignment in Break condition

查看:84
本文介绍了在休息条件下进行分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在测试某些东西时,我不得不替换字符串(很多次!),同时又懒得停止调试器并编写我的代码。相反,我认为我可以在Break条件下执行此操作以查看其是否有效。



因此,break条件如下所示:



(someString = someString.Replace(。xx。, .yy。))!=



每次都会评估为真。



但是它不会执行赋值操作。有人可以解释为什么条件评估正确,但分配却从未发生吗?代替。 Break条件的目的是在表达式为真时中断,而不是连续更改实际值。



需要恕我直言是很奇怪的。


While testing something, I had to replace string (many times!) while feeling lazy to stop debugger and write up my code. Instead I thought I can do this in Break condition to see if it works.

So the break condition looks like this:

(someString = someString.Replace(".xx.", ".yy.")) != ""

Which would evaluate to true every time.

But it doesn't do the assignment. Can someone explain why the condition is evaluated correctly, but assignment never happens?

解决方案

You should do this in the Watch or Immediate windows instead. The purpose of the Break condition is to break when an expression is true, not to continuously change a real value.

It's quite a bizarre need IMHO.

这篇关于在休息条件下进行分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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