Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的 Windows-Phone 应用程序中,我需要使用一个需要运行很长时间直到不再满足的条件。
如何创建某种形式的逻辑循环?我尝试过使用一个if语句,但这只循环一次。
if
我对 c# 相当陌生,并且不确定所有不同的逻辑条件。
谢谢你的帮助。
你正在寻找一个while循环:
while
while(condition) { // do stuff }
或者可能是一个do-while循环:
do-while
do { // do stuff } while (condition);
这里的区别在于while-loop 总是在第一次迭代之前评估它的条件,而do-while-loop 在第一次迭代之后评估它。
延伸阅读