Re: Declaring a constant

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Chris,

>I have made a declaration like this:
>
> private const Complex I = new Complex(0.0, 1.0);
>
> When I try to build this I get the error:
>
> The expression being assigned to 'ComplexNumberLib.ComplexMath.I' must be
> constant.

A constant expression is an expression that can be fully evaluated at
compile time. Therefore, the only possible values for constants of reference
types are string and null.

Regards,

Randy


.



Relevant Pages