I am implementing the show-message extension found on this blog: http://blogs.taiga.nl/martijn/2011/05/03/keep-your-users-informed-with-asp-net-mvc/
the programmer makes clever reuse of his enum to build css attribuuts but in vb.net i run on something strange.
I need this class
Enum Messagetype
Succes = 1
Error = 2
Notification = 3
End Enum
but visual studio keeps giving an error on the Error enum. Is there a prefix i can use to tell visual studio its ok to use error as enum ?
In VB.NET, Enum is a keyword known as Enumeration. Enumeration is a user-defined data type used to define a related set of constants as a list using the keyword enum statement. It can be used with module, structure, class, and procedure. For example, month names can be grouped using Enumeration.
Enums are compiled as constant static fields, their values are compiled into you assembly, so no, it's not possible to change them. (Their constant values may even be compiled into places where you reference them.)
It is a primitive data type, which is user-defined. Enums type can be an integer (float, int, byte, double etc.) but if you use beside int, it has to be cast. Enum is used to create numeric constants in .
You could wrap reserved words in []
in VB.NET (the same as the @
in C#):
Enum Messagetype
Succes = 1
[Error] = 2
Notification = 3
End Enum
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With