使用"对于(;;)QUOT;在C#应用程序? [英] Use of "for (;;)" in a C# application?
本文介绍了使用"对于(;;)QUOT;在C#应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在寻找通过为我使用的应用程序的一些示例源代码,我碰到这条线就来了:
的(;;)
{
//应用程序的代码
其余}
看起来是创建一个无限循环,但我不熟悉的;;它是很难谷歌很遗憾。
解决方案
是的,这是一个无限循环。这是一个普通的,没有条件表达式循环。
从的为文档
:
所有表达式for语句都是可选的;例如,下面的语句是用来写一个无限循环:
为(;)
{
// ...
}
块引用>I've been looking through some sample source code for an application I use and I came across this line:
for (;;) { // The rest of the application's code }
It looks like this is to create an infinite loop, but I'm not familiar with ";;" and it's very hard to Google unfortunately.
解决方案Yes, that is an infinite loop. It's an ordinary for loop with no condition expression.
From the documentation for
for
:All of the expressions of the for statement are optional; for example, the following statement is used to write an infinite loop:
for (; ; ) { // ... }
这篇关于使用"对于(;;)QUOT;在C#应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文