컴파일러 오류 CS0504

‘variable’ 상수는 static으로 표시할 수 없습니다.

변수가 const이면 static이기도 합니다. conststatic 변수를 원하는 경우 해당 변수를 const로 선언하면 됩니다. static 변수만 원하는 경우 static으로 표시합니다.

다음 샘플에서는 CS0504를 생성합니다.

// CS0504.cs  
namespace x  
{  
   abstract public class clx  
   {  
      static const int i = 0;   // CS0504, cannot be both static and const  
      abstract public void f();  
   }  
}