c# - 未知 while while 语句

标签 c# .net

我看到一些人的代码是这样的:

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/

相关文章:

c# - 使用 ExecuteSqlCommand 从存储过程中获取返回值(使用 Entity Framework )

.Net 4.5 和 Azure

c# - 为 Web 服务生成动态 XML 的最佳方法是什么?

c# - 调用 native (DllImport) 函数时出现 StackOverflowException

c# - 属性中的通用类型类名

c# - 无法连接到Redis服务器

c# - 是否可以设置页面特定的 cookie?

.net - NetMQ 代理与 XSub/Xpub 模式中的控制套接字使用示例?

c# - 如何让一个代码运行在所有的aspx页面上?

c# - 有什么好的工具可以将 GWT 与 ASP.Net 集成?