Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The evaluation of the constant value for 'const declaration' involves a circular definition
The declaration of a const variable (a) cannot reference another const variable (b) that also references (a).
The following sample generates 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;
}
}