Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Red isn't a constant
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01064507
Message ID:
01064799
Views:
18
>>Ya, you're right - I was looking at the KnownColor which is an enum but the object color is a struct.
>>
>>Interesting...
>
>Victor,
>Yeah it is kind of interesting. Neil posted a section from the docs that explain that a constant can not be a class or a struct. The docs does not explain why a class or a struct can be used as a constant.

Constants must be evaluated at compile time. Functions must be evaluated at run time. Since a struct may well have functions (including a constructor), I don't see how it can be acceptable to the compiler as a constant.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform