Skip navigation.

Blog

Using Reserved Words as Identifiers in VB.Net

Up until now, if I wanted to use a reserved keyword as a variable, function or property name (such as Public Property ReadOnly() As Boolean), the compiler would complain.

Luckily I happened across a very simple answer yesterday; VB.Net works in a similar way to SQL - to use a reserved word as an identifier, just put square brackets around it!

i.e. Public Property [ReadOnly]() As Boolean

File under: things I can't believe I didn't know!


Reader Comments

Skip to form

April 16, 2009, ryla says:

THANKS works like a charm


Comment on This Article:

Your Name:
Your Email Address:
 

Your Email Address will not be made public.
Comment:
All HTML, except <i>, <b>, <u> will require your comment to be moderated before it is publicly displayed.
 
If you would like your own avatar displayed, read about comment avatars.