Visual Basic .NET Handling of Reserved Words

Visual Basic .NET allows you to use reserved words in code. If you accidentally use a reserved word, such as Enum, as a variable, the IDE will place square brackets around the word. You can then use the reserved word in a non-reserved way as long as every occurrence has the brackets around the reserved word.

Using reserved words in this way probably isn't a good idea because it may lead to confusing, unsightly code. It's also a safe bet that this quirk won't survive for long.

Unfortunately, there are times when you may not be able to avoid using keywords, especially when they define a type. The System.Reflection namespace defines the type Assembly. Assembly is both a type and a keyword. When you declare ...

Get Visual Basic® .NET Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.