컴파일러 오류 CS0145

업데이트: 2007년 11월

오류 메시지

상수 필드에 값을 입력해야 합니다.
A const field requires a value to be provided

const 변수를 초기화해야 합니다. 자세한 내용은 상수(C# 프로그래밍 가이드)를 참조하십시오.

다음 샘플에서는 CS0145 오류가 발생하는 경우를 보여 줍니다.

// CS0145.cs
class MyClass
{
   const int i;   // CS0145
   // try the following line instead
   // const int i = 0;

   public static void Main()
   {
   }
}