컴파일러 오류 CS0110
업데이트: 2007년 11월
오류 메시지
'const declaration'에 대한 상수 값 계산에 순환 정의가 포함되어 있습니다.
The evaluation of the constant value for 'const declaration' involves a circular definition
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;
}
}