[英]C# Is it possible to testing if statement using immediate window in visual studio?
i want to test if
statements directly, my problem is it's waiting so many long to test my if
statements in my code
. 我想直接测试
if
语句,我的问题是等待很长时间才能在code
测试我的if
语句。 this is my code
: 这是我的
code
:
byte isFive = _checkReadLengthIsFive;
if (readLength == 5)
{
isFive++;
_checkReadLengthIsFive = isFive;
if (isFive == 2)
{
string appendText = "WRITE FAIL" + Environment.NewLine;
File.AppendAllText(Fullpath, appendText);
DisplayData(MessageType.Incoming, "DAPAT!" + "\n");
}
}
to reach in this if
statement, i waiting so long because readLength = 5
is rarely happening. 要到达此
if
语句,我等待了很长时间,因为readLength = 5
很少发生。 Is it possible to use immediate window? 是否可以使用即时窗口? if possible please tell me how?
如果可能,请告诉我如何? thanks for helping and responses.
感谢您的帮助和回应。
Yes you can change a variable's value in the immediate window while your code is running (debugging). 是的,您可以在代码运行(调试)时在立即窗口中更改变量的值。 You should be able to set the variable's value by using the window and typing something like readLength = 5;.
您应该能够通过使用窗口并键入诸如readLength = 5;之类的内容来设置变量的值。 You are also able to hover the mouse over the variable and click on the value and type in a new value.
您也可以将鼠标悬停在变量上,然后单击值并输入新值。
If you want to test your code inside if statement, just change the code from 如果要在if语句中测试代码,只需将代码更改为
if (readLength == 5)
如果(readLength == 5)
to 至
if (true)
如果属实)
After everything is ok, you change back to if (readLength == 5) 一切正常之后,您将更改回if(readLength == 5)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.