Freigeben über


Compilerfehler CS0133

Der Ausdruck, der 'Variable' zugewiesen wird, muss konstant sein.

Eine const -Variable kann keinen Ausdruck als ihren Wert übernehmen, der nicht konstant ist. Weitere Informationen finden Sie unter Konstanten.

Im folgenden Beispiel wird CS0133 generiert:

// CS0133.cs  
public class MyClass  
{  
   public const int i = c;   // CS0133, c is not constant  
   public static int c = i;  
   // try the following line instead  
   // public const int i = 6;  
  
   public static void Main()  
   {  
   }  
}