我看到一些人的代码是这样的:
while (!(baseType == typeof(Object)))
{
....
baseType = baseType.BaseType;
if (baseType != null)
continue;
break;
} while (baseType != typeof(Object));
什么是 while(...) {...} while(...)
语句?
是下面的等效代码吗?
while (baseType != null && baseType != typeof(Object))
{
....
baseType = baseType.BaseType;
}
最佳答案
没有 while() ... while();
语句,所以它实际上是两个 while 语句,例如:
当它们具有相同的条件时,就像在您的示例中,第二个是无用的。
编辑:
实际上,做一些测试我开始意识到它实际上是两个循环,比如:
while(...) { ... }
while(...);
关于c# - 未知 while while 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7160045/