Compilerfehler CS0133
Aktualisiert: November 2007
Fehlermeldung
Der Ausdruck, der "Variable" zugewiesen wird, muss konstant sein.
The expression being assigned to 'variable' must be constant
Eine const-Variable kann keinen Ausdruck als Wert annehmen, der nicht konstant ist. Weitere Informationen finden Sie unter Konstanten (C#-Programmierhandbuch).
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()
{
}
}