Export (0) Print
Expand All
Expand Minimize
0 out of 2 rated this helpful - Rate this topic

Compiler Error CS0133

The expression being assigned to 'variable' must be constant

A const variable cannot take as its value an expression that is not constant.

The following sample generates CS0133:

// CS0133.cs
public class A
   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()
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.