Using VB.Net and C#.Net reserved words as regular names

I don’t advise to use this unless you really have to. When using .Net reserved words for other purposes, it can become confusing for you or your collaborators. So use this only when it’s necessary or if it might actually help. I’ve come across a good example of the second option while creating an enumeration.

VB.Net:

C#.Net:

So by using ‘[‘ and ‘]’ in VB.Net and ‘@’ in C#.Net, you can take away the meaning of the reserved word and use it as you like. But as stated above, avoid this as much as possible unless it’s appropriate like in the examples above.

Leave a Reply

Your email address will not be published. Required fields are marked *