How to use names as enum that are already used by vb.net as keyword
I am implementing the show-message extension fo开发者_开发知识库und 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 ?
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
精彩评论