Compilerfehler CS0504

Die Konstante "Variable" kann nicht als statisch markiert werden.

Wenn eine Variable konstant ist, ist sie auch statisch.Wenn Sie sowohl eine konstante als auch eine statische Variable benötigen, deklarieren Sie die Variable als konstant; benötigen Sie eine statische Variable, markieren Sie sie nur als statisch.

Im folgenden Beispiel wird CS0504 generiert:

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