更新:2007 年 11 月
错误消息
“const declaration”的常数值计算涉及循环定义
const 变量 (a) 的声明不能引用另一个也引用 (a) 的 const 变量 (b)。
下面的示例生成 CS0110:
// CS0110.cs
namespace MyNamespace
{
public class A
{
public static void Main()
{
}
}
public class B : A
{
public const int i = c + 1; // CS0110, c already references i
public const int c = i + 1;
// the following line would be OK
// public const int c = 10;
}
}